PHP, JS, CSS, Python, and Machine Learning TechnologyHow To Speed Up a WordPress (WP) Web Site Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist To speed up a WordPress (WP) site, you need a combination of a solid foundation (hosting, theme) and optimization techniques (caching, image compression, code minification). ...
PHP, JS, CSS, Python, and Machine Learning TechnologyJavaScript Frameworks and Libraries List Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist JavaScript frameworks and libraries are collections of pre-written JavaScript code designed to streamline and enhance web development. While both provide reusable code, their primary distinction ...
PHP, JS, CSS, Python, and Machine Learning TechnologyTypes of Linux Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Linux is most widely used by advanced users who always want to have more control over their system. In this user are allowed to easily install and manage software packages by using a package manager ...
PHP, JS, CSS, Python, and Machine Learning TechnologyUser Agents for Web Scraping Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist When scraping large amounts of information, the main problem is the risk of blocking and how to avoid it. We have already discussed that you can use captcha-solving services, proxies, or even a web ...
PHP, JS, CSS, Python, and Machine Learning TechnologySolid-State Drive (SSD) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Solid-State Drive (SSD) is a solid-state storage device that uses integrated circuit assemblies to store data persistently, typically using flash memory. SSDs store data in semiconductor cells. where ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHEADer.php Metadata Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist To turn your web pages into graph objects, you need to add basic metadata to your page. We've based the initial version of the protocol on RDFa which means that you'll place ...
PHP, JS, CSS, Python, and Machine Learning TechnologyLargest Contentful Paint Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Developers today don't have a reliable metric that correlates with their user's visual rendering experience. Existing metrics such as First Paint and First Contentful Paint focus on initial ...
PHP, JS, CSS, Python, and Machine Learning TechnologyComputer Short Code Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist বর্তমান দিনে কম্পিউটার ছাড়া আমাদের এক পা এগোনো খুব কঠিন হয়ে উঠেছে।আপনি কয়েক সেকেন্ডের মধ্যে কিভাবে কম্পিউটার শিখতে ও চালাতে পারবেন সেই জন্য এই পোস্ট Ctrl + A ফাইলের সব কিছু সিলেক্ট করা (All ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is Largest Contentful Paint Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Developers today don't have a reliable metric that correlates with their user's visual rendering experience. Existing metrics such as First Paint and First Contentful Paint focus on initial ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is HTML5? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist HTML is the core foundational standard being worked on by the WHATWG community. It is continuously maintained and supersedes HTML4, XHTML1, DOM Level 2 HTML, and all previous HTML specifications — ...
PHP, JS, CSS, Python, and Machine Learning TechnologyThe chunks-webpack-plugin Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The chunks-webpack-plugin creates HTML files with entry points and chunks relations to serve your webpack bundles. It is suitable with multi-page applications that contain multiple entry points. ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHtmlWebpackPlugin Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The HtmlWebpackPlugin simplifies creation of HTML files to serve your webpack bundles. This is especially useful for webpack bundles that include a hash in the filename which changes every ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat does webpack mean by XX hidden modules Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Webpack hides modules coming from folders like in your console output by default. This helps you to focus on your modules instead on your dependencies. You can display them by using the ...
PHP, JS, CSS, Python, and Machine Learning TechnologyTiny URL shortner Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist At first glance, each long URL and the corresponding alias form a key-value pair. In a certain sense, a URL shortener is a giant hash table, which maps integer values to full URL strings. The integer ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhatsapp-Basic-Features-of-a-chat-app. Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Now, Let us take a good look at the inbuilt features offered by a comprehensive chat app:1. Instant Messaging: This is the basis of your app’s success, and a basic feature of all chat apps. It ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is a WebSocket API? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist According to MDN, the WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With the WebSocket ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWays to decrease page load (perceived or actual load time). Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Minifying a file involves removing unnecessary formatting, whitespace, and code. Since every unnecessary piece of code adds to the size of your page, it’s important that you eliminate extra spaces, ...
PHP, JS, CSS, Python, and Machine Learning TechnologyDifferences between HTTP and HTTPS Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist HTTPS: Encrypted Connections The two are essentially the same, in that both of them refer to the same “hypertext transfer protocol” that enables requested web data to be presented on your screen. ...
PHP, JS, CSS, Python, and Machine Learning TechnologyThe critical rendering path (CRP) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The critical rendering path (CRP) looks at the sequence of steps the browser takes to receive HTML, CSS, and JavaScript bytes, as well as the techniques required to render the initial view of the web ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat-happens-when-you-navigate-to-google Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist First of all your computer has to interpret the signals coming through from your keyboard—each key press closes a specific electrical circuit that tells your computer the letters and symbols you’re ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat happens when you navigate to an URL Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist This is a classical question in an interview. We can concatenate the topics all above in this theme:Do the DNS query first, it will offer the most suitable IP address with the intelligent DNS ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPostman-checking-protected-routes-from-backend Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist How to get-the-token-in-postman-whenever-i-use-middleware-in-my-private-routes, so I can check from back-end that my secured authenticated routes ( secured with Passport.authenticate middleware) are ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHow to Check HTTP Request and Response on Chrome? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Open a webpage ( say https://github.com/rohan-paul ) in Google Chrome and go to “View > Developer > Developer Tools” menu. You can also open the developer console by right clicking on the page ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat Does the POST Method Do? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Aapart from GET, there are other types of HTTP methods including: HEAD POST PUT DELETE CONNECT OPTIONS TRACEWhat Does the PUT Method Do? The PUT method completely replaces whatever currently ...
PHP, JS, CSS, Python, and Machine Learning TechnologyTCP (Transmission Control Protocol) vs HTTP (HyperText Transfer Protocol) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist 1. The most fundamental difference between the two is that TCP and HTTP works at different layers, i.e, they have independent (and radically different ) tasks to perform. TCP is a transport-layer ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHTTP Status Error Codes Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The HTTP status codes are developed as per the Internet standards defined by Internet Engineering Task Force (IETF). They are classified into five different categories as below: 1xx series – ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHTTP Status Codes Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The HTTP status codes are developed as per the Internet standards defined by Internet Engineering Task Force (IETF). They are classified into five different categories as below: 1xx series – ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHTTP-Status-Codes-Understanding-Express-res.status Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The res object represents the HTTP response that an Express app sends when it gets an HTTP request. Source: https://www.tutorialspoint.com/nodejs/nodejs_response_object.htm res.status(code) ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is that HTTPS? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist HTTP is a method for encoding and transporting data between a client and a server. It is a request/response protocol: clients issue requests and servers issue responses with relevant content and ...
PHP, JS, CSS, Python, and Machine Learning TechnologyJS to TypeScript Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Normally, we can put normal JS code and get no help from what TypeScript has to offer. In order to TS to force us to actually type our code, we need to change the ‘tsconfig.json’ file. In particular, ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat are Thunks? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Thunks are a functional programming technique used to delay computation. Instead of performing some work now, you produce a function body or unevaluated expression (the “thunk”) which can optionally ...
PHP, JS, CSS, Python, and Machine Learning TechnologyRedux-thunk-basic Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Thus, in summary there are two parts to Redux-Thunk:A thunk creator, which is an action creator that returns a thunk (a.k.a. asynchronous action creators)The thunk itself, ...
PHP, JS, CSS, Python, and Machine Learning TechnologymapStateToProps-how-exactly-it-gets-the-state-from-reducers Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist How exactly does mapStateToProps know which is the state variable that I am talking about. In other words, when I have many reducers file how each component, will get its specific states from ...
PHP, JS, CSS, Python, and Machine Learning TechnologyThe state argument of mapStateToProps(state) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist mapStateToProps() is a utility which helps your component get updated state(which is updated by some other components),mapDispatchToProps() is a utility which will help your component to fire an ...
PHP, JS, CSS, Python, and Machine Learning TechnologymapStateToProps-basic-understanding Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist All mapStateToProps() does is, it takes a piece from the App's single state-tree i.e. the store and turn this into a component prop, so I can use it in this current component as a regular prop. ...
PHP, JS, CSS, Python, and Machine Learning TechnologymapStateToProps() Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Basically with mapDispatchToProps I connect a Redux action to a React component. mapDispatchToProps function let's us inject certain props into the React component that can dispatch actions. ...
PHP, JS, CSS, Python, and Machine Learning TechnologyFlux is a pattern and Redux Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Flux is a pattern and Redux is a library. Flux is a fancy name for the observer pattern modified a little bit to fit React. Both Flux and Redux have actions. Actions can be compared to events (or ...
PHP, JS, CSS, Python, and Machine Learning TechnologyDispatch(action) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist https://redux.js.org/api-reference/store#dispatch dispatch() is one of the 4 methods of redux-store. dispatch() is the method used to dispatch actions and trigger state changes to the ...
PHP, JS, CSS, Python, and Machine Learning TechnologyCreateStore (reducer, [preloadedState], [enhancer]) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist We create a store, using the createStore function. We pass it our reducer, and then use the compose function to create a single function from two other functions. It takes other middlewares and ...
PHP, JS, CSS, Python, and Machine Learning TechnologyContainer-component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist And container is a component , where I am using a Redux state inside of a React component. Because note, while we have the application state in redux store, but here in this component I am again ...
PHP, JS, CSS, Python, and Machine Learning TechnologyStore Enhancers are Higher Order Functions Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Compose is used when you want to pass multiple store enhancers to the store. Store enhancers are higher order functions that add some extra functionality to the store. The only store enhancer which ...
PHP, JS, CSS, Python, and Machine Learning TechnologyBindActionCreators Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist One of the crucial thing in Redux is binding the action creators to dispatch. Without this binding firing an action creator will do nothing. Now mapDispatchToProps is not the only way of bind ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPayload can be any valid JS Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Payload is a non-official, community accepted (de facto) naming convention for the property that holds the actual data in a Redux action object. The official documentation only states that a Redux ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhy enclose actions returned by Redux action creators in curly braces? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Why enclose actions returned by Redux action creators in curly braces? 1> https://medium.com/@leannezhang/curly-braces-versus-parenthesis-in-reactjs-4d3ffd33128f Curly braces { } are special ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReducers – Absolute Basic Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Reducers - Absolute BasicReducer is just a function that takes two arguments A) Action (which is just a plain JS object preferably with type property ) andB) It takes the current state of ...
PHP, JS, CSS, Python, and Machine Learning TechnologyProvider (Its a HOC concept) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist If we want to link our React application with the redux store, we first have to let our app know that this store exists. This is where we come to the first major part of the react-redux library, ...
PHP, JS, CSS, Python, and Machine Learning TechnologyConnect component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Connects a React component to a Redux store. The first argument to connect is mapStateToProps() function. What mapStateToProps() does is, it allows us to take our state (e.g. item state (from ...
PHP, JS, CSS, Python, and Machine Learning TechnologyAction Creator and Object serialization Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist In this file, you will write the functions that dispatch an action. These functions will be linked to your component props by the container’s mapDispatchToProps function. At that point, a component ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is state? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist State is used internally by components to dynamically change data. Unlike props, state can only be set within the component itself. Unlike props, state is a private feature and it strictly belongs to ...
PHP, JS, CSS, Python, and Machine Learning TechnologySetState() method in ReactJS Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The first thing React will do when setState is called is merge the object you passed into setState into the current state of the component. This will kick off a process called reconciliation. The end ...
PHP, JS, CSS, Python, and Machine Learning TechnologyServer-side rendering (SSR) Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Server-side rendering (SSR) typically improves SEO and performance. Server Side Rendering, also called SSR, is the ability of a JavaScript application to render on the server rather than in the ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHow to run / launch the individual index.html Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist When simply adding React to a normal .html file and running tha .html file directly in Chrome will throw cross-origin error. So, I have run this .html file with a local web-server. How to run / ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReact Hot Loader Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist React Hot Loader is a plugin that allows React components to be live reloaded without the loss of state. It works with Webpack and other bundlers that support both Hot Module Replacement (HMR) and ...
PHP, JS, CSS, Python, and Machine Learning TechnologyImmutability Is Important for PureComponents Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist PURE COMPONENT is one of the most significant ways to optimize React applications. The usage of Pure Component gives a considerable increase in performance because it reduces the number of render ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPureComponent-Performance-benefit Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Generally people think, an easy way to optimize a React component for performance is to make it a class, and make it extend React.PureComponent instead of React.Component. This way, the component ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is preventDefault() in React? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist React uses synthetic events to handle events from button, input and form elements. A synthetic event is a shell around the native DOM event with additional information for React. Lets see the code ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPass-props-from-Child-to-parent-Component-communication Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist We need a way for the child component to tell the parent component to update without breaking one-way data flow. Since we are using local state, we need a way for the child component to tell the ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPass-prop-to-component-rendered-by-React-Router. Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist If you need to pass a prop to a component being rendered by React Router, instead of using Routes component prop, use its render prop passing it an inline function then pass along the arguments to ...
PHP, JS, CSS, Python, and Machine Learning TechnologyonChange event in plain JS Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The onchange event occurs when the value of an element has been changed. For radiobuttons and checkboxes, the onchange event occurs when the checked state has been changed. Execute a ...
PHP, JS, CSS, Python, and Machine Learning TechnologyNo-constructor-for-stateful-component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist We’ve all been taught that the constructor is where we initialize our instance properties, state in this case. And thats true till ES-6. However, that is no more true, for the upcoming ES.next class ...
PHP, JS, CSS, Python, and Machine Learning Technologykeys-for-li-elements-why-its-needed Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Keys in React are utilised to identify specific Virtual DOM Elements that have changed. The classic example of usage of keys is a list. Keys are important when rendering collections of items in ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat are the approaches to include polyfills in your create-react-app? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist What are the approaches to include polyfills in your create-react-app? There are approaches to include polyfills in create-react-app, Manual import from core-js: Create a file called (something ...
PHP, JS, CSS, Python, and Machine Learning Technologyhistory.push Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist this.props.history.push("/") Official DocEffectively this is the most common way to implement redirect after a successful form submission. Use case in my MERN book library repoonSubmit = ...
PHP, JS, CSS, Python, and Machine Learning TechnologyFunctional-component-declaration-syntax Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Converting a class-based component to Functional Componentclass TableRowWrapper extends Component { render() { return <tr>{this.props.children}</tr>; } }Now the ...
PHP, JS, CSS, Python, and Machine Learning Technologye.target.value Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The most common implementation of this is as follows to capture the change of event for typing in a form (a login form for example)handleChange(event) { this.setState ({ : ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is destructuring in the context of React Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Very simply its passing an object as an argument to the function, but the destructuring uses only the named properties of the object.const destructuring = ({ used }) => console.log(used); ...
PHP, JS, CSS, Python, and Machine Learning Technologydestructuring_basics-js Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Without using the destructuring syntax getting multiple values out of an array can be quite cumbersome. You would do something like this:const items = ;const car = items; const bike = ...
PHP, JS, CSS, Python, and Machine Learning TechnologyControlled-unContolled-Component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist A large part of React is this idea of having components control and manage their own state. What happens when we throw native HTML form elements (input, select, textarea, etc) into the mix? Should we ...
PHP, JS, CSS, Python, and Machine Learning TechnologyImplementing this React context API Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist One simple use case for implementing this React context API Have you ever experienced the pain of trying to get state from the top of your react tree to the bottom? This pain you’re feeling is ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is reconciliation Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist React is magical, but it still can’t get around the fact that we must build a DOM for the user to see anything. Building a DOM on every page load is not really faster than old-fashioned HTTP calls ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is DOM rendering – Virtual-DOM-and-Reconciliation-Algorithm Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The virtual DOM is a tree based on JavaScript objects created with React that resembles a DOM tree. Each time you need to change something in the DOM, React employs a different algorithm that ...
PHP, JS, CSS, Python, and Machine Learning TechnologyRedirect Component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Rendering a will navigate to a new location. The new location will override the current location in the history stack, like server-side redirects (HTTP 3xx) do. ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReact Fragment Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist All return values need to be wrapped in a div. This is because a component can only return one single element, and if you want more than one, you need to wrap it with another container tag. This, ...
PHP, JS, CSS, Python, and Machine Learning TechnologyExplain-whats-wrong-with-this-React-code Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Technical interviews may also include time where the developer is asked to look at (and probably write) some code. Hence, take a look at the code below. Can you identify two problems ?class ...
PHP, JS, CSS, Python, and Machine Learning TechnologyCreate-Class-avoiding-binding-in-constructor Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Standard way to define classclass Counter extends Component {constructor (props) { super(props)this.state = { counter: 0, }// I have ...
PHP, JS, CSS, Python, and Machine Learning TechnologyRefs-and- key- in-React Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist First off, let me express that this is generally not the way to go about things in React land. Usually what you want to do is pass down functionality to children in props, and pass up notifications ...
PHP, JS, CSS, Python, and Machine Learning TechnologyRedux Source Code Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Lets look at the Redux Source Code https://github.com/reduxjs/redux/blob/9d3273846aa8906d38890c410b62fb09a4992018/src/combineReducers.ts#L197let hasChanged = false const nextState: ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is Snapshot testing Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist A cool feature that Jest has is snapshots. This takes a snapshot of your component and how it renders and then will compare that whenever doing other tests to let you know if something unexpected is ...
PHP, JS, CSS, Python, and Machine Learning TechnologyShallow Renderer Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist When writing unit tests for React, shallow rendering can be helpful. Shallow rendering lets you render a component “one level deep” and assert facts about what its render method returns, without ...
PHP, JS, CSS, Python, and Machine Learning TechnologyStyled-component Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The main thing you need to understand about Styled Components is that its name should be taken quite literally. You are no longer styling HTML elements or components based on their class or HTML ...
PHP, JS, CSS, Python, and Machine Learning TechnologyUseState-replace-componentWillReceiveProps-getDerivedStateFromProps Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist While useReducer with its reducer is a part of how Redux works, it isn’t Redux. The useReducer function is tightly coupled to its reducer which holds also true for its dispatch function. We dispatch ...
PHP, JS, CSS, Python, and Machine Learning TechnologyUseReducer Hook Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist useReducer hook accepts two arguments first argument is reducer function and second argument is initial app state then it return array with two elements - state and a dispatch function. A Reducer ...
PHP, JS, CSS, Python, and Machine Learning TechnologyUseEffect-running-callback-after-setState-IMPORTANT Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The basic flow is like belowconst = useState(false);...setLoading(true); doSomething(); // <--- when here, loading is still false.Setting state like above is still async, so ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReplacing componentWillUnmount with useEffect() Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Replacing componentWillUnmount with useEffect()componentWillUnmount() { console.log('will unmount'); }// Now to replicate the above, just return a function inside useEffect() which will ...
PHP, JS, CSS, Python, and Machine Learning TechnologyuseEffect-compare-array-in-second-argument-shallow Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Problem - Effect re-run endlessly when using an array as a second argument for useEffect which is not the case when I use the array.length instead CodeSandbox : codesandbox.io/s/nrwq08p9zj (you can ...
PHP, JS, CSS, Python, and Machine Learning TechnologyThe problem around dependency array Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The problem around dependency array I trying to wrap my head around the new hooks api of react. Specifically, I'm trying to construct the classic use case that once was the following:...
PHP, JS, CSS, Python, and Machine Learning TechnologyUseEffect Hook as componentDidMount Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Mutations, subscriptions, timers, logging, and other side effects are not allowed inside the main body of a function component (referred to as React’s render phase). Doing so will lead to confusing ...
PHP, JS, CSS, Python, and Machine Learning TechnologySecond array argument to useEffect() Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Fetching Hacker News hits data - The App component shows a list of items (hits = Hacker News articles). The state and state update function come from the state hook called useState that is ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReact DOM Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Starting with 18.0, React includes a stable implementation of React Hooks for:React DOM React Native React DOM Server React Test Renderer React Shallow RendererNote that to ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is Shallow Comparison from Official dox Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist A> When shallow comparing scalar values (numbers, strings) it compares their values. When comparing objects, it does not compare their attributes - only their references are compared (e.g. ...
PHP, JS, CSS, Python, and Machine Learning TechnologyAJAX requests should go in the componentDidMount lifecycle event. Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Fiber, the new React reconciliation algorithm, has the ability to start and stop rendering as needed for performance benefits. One of the trade-offs of this is that componentWillMount, the other ...
PHP, JS, CSS, Python, and Machine Learning TechnologyReact lifecycle methods Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist First of all, from a blog post in late March 2018, it was announced that the React lifecycle methods componentWillReceiveProps, componentWillMount, and componentWillUpdate will be deprecated in a ...
PHP, JS, CSS, Python, and Machine Learning TechnologyComponentDidUpdate Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist First of all, from a blog post in late March 2018, it was announced that the React lifecycle methods componentWillReceiveProps, componentWillMount, and componentWillUpdate will be deprecated in a ...
PHP, JS, CSS, Python, and Machine Learning TechnologyComponentWillMount Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist componentWillMount is called before the render method is executed. It is important to note that setting the state in this phase WILL NOT TRIGGER a RE-RENDERING.componentWillMount();...
PHP, JS, CSS, Python, and Machine Learning TechnologyMultiple-sequential-execution- axios-request Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist JavaScript is single threaded, that means only one statement is executed at a time. As the JS engine processes our script line by line, it uses this single Call-Stack to keep track of codes that are ...
PHP, JS, CSS, Python, and Machine Learning TechnologyCode with sequential execution Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Transform the following code with sequential execution. I want to fire second request based on one value returned by the first request. For example, the Fetch API provides an interface for making ...
PHP, JS, CSS, Python, and Machine Learning TechnologyAsync/await And Complements Promises Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Async/await is a language structure that complements promises. It allows us to work with promises with less boilerplate. For example, the following definitions are equivalent:function f() { ...
PHP, JS, CSS, Python, and Machine Learning TechnologyCallback Hell Example Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist A function passed to then can also return another promise. This allows asynchronous operations to be chained together, so that they are guaranteed to happen in the correct ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHow do you listen for when the status of a promise changes? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist A promise is an object that wraps an asynchronous operation and notifies when it’s done. This sounds exactly like callbacks, but the important differences are in the usage of Promises. Instead of ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHow-Promise-makes-code-Asynchronous-non-blocking Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Key Point - With the .then() method, we can chain our ASYNCHRONOUS calls in a SYNCHRONOUS manner. So, within the Promise block, I am converting few Asynchronous operations to Synchronous ones. And ...
PHP, JS, CSS, Python, and Machine Learning TechnologyAbsolute-super-basic-Promise-creation Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist And note some fundamentals of Promise - When you create a new Promise, you're really just creating a plain old JavaScript object. This object can invoke two methods, then, and catch. Both .then() and ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPromise object Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Promise object is used for handling asynchronous computations which has some important guarantees that are difficult to handle with the callback method (the more old-school method of handling ...
PHP, JS, CSS, Python, and Machine Learning TechnologyHow is Node.js different different from Javascript? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Ans: Node.js uses a library called libuv, to bring an asynchronous event driven model to Javscript. It piggy backs on Chrome's Javascript Engine called V8 to enable the use of Javascript's call ...
PHP, JS, CSS, Python, and Machine Learning TechnologyLocalStorage and SessionStorage Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist localStorage and sessionStorage both extend Storage. There is no difference between them except for the intended "non-persistence" of sessionStorage. That is, the data stored in localStorage ...
PHP, JS, CSS, Python, and Machine Learning TechnologyCookie-Based Authentication Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Cookie-based authentication has been the default, tried-and-true method for handling user authentication for a long time. Cookie-based authentication is stateful. This means that an authentication ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPipe-in-node Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The pipe() function reads data from a readable stream as it becomes available, and writes it to a destination writable stream. It does all "reasonable" things along the way with errors, end of files, ...
PHP, JS, CSS, Python, and Machine Learning TechnologyConceptual Workflow Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist If you’ll recall, Express works with a request-response cycle in which callback functions are tied to specific routes and have access to request and response objects, like so:app.get('/', ...
PHP, JS, CSS, Python, and Machine Learning TechnologyWhat is a session? Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist The very basic steps of express-session and cookie-based session management The first time a browser makes a request to our server, express session generates a unique session id 2. saves that ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPassport-authentication-middleware-BASIC-FLOW. Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Passport is a framework, and a Node.js middleware, that is extremely flexible and modular. It allows you to work with the main authentication strategies: Basic & Digest, OpenID, OAuth, OAuth 2.0 ...
PHP, JS, CSS, Python, and Machine Learning TechnologyPackage.json file Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Explanation so, basically it removes all the create and start server code from your app.js and let you focus only on the application logic part. Note: If you see in package.json file you would note ...
PHP, JS, CSS, Python, and Machine Learning TechnologyNode-debugging Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist Since version 6.3, Node.js provides a built-in DevTools-based debugger which mostly deprecates Node Inspector, see e.g. this blog post to get started. The built-in debugger is developed directly by ...
PHP, JS, CSS, Python, and Machine Learning TechnologylocalForage is a fast and simple storage library for JavaScript. Dr. Harun Ar Rashid, MD - Arthritis, Bones, Joints Pain, Trauma, and Internal Medicine Specialist localForage improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API. Official site An important step on the path ...