We often come across the term High-Order function when working with Functional programming. High-Order function is nothing but a pure function that can take one or more functions as arguments or returns a function as output when invoked.
Let’s take an example to understand better.
Example #1: In the example below, a concatStr function is a higher-order function that returns a function that takes a sentence as an argument and appends the lang which is passed as an argument to the value that is being returned.
Some of you may be using alert() Method for debugging but I personally try to avoid using it because of certain limitation:-
2. When we use it in a loop it makes things more difficult to handle.
3. When we move…
React Hooks (>16.8): Hooks provide us to use states (react objects) in a functional component. Hooks help us to work with state, effect, and context which were once only possible in React Class. It provides a more direct API to the React concepts like props, state, context, refs, and lifecycle. Hooks are backward compatible and it’s not a replacement for React Class.
Let’s understand the React hook concept better by taking a Class component and Functional component example.
Let's write a logic where we try to set a state which holds the value of the switch. Based on the clicking…
Context API(>React’s version 16.3) — The Context API provides a way to share data between components without having to pass a prop through every level of the component tree. Context API is not a total replacement for the lib like Redux or MobX or any other state management library.
Let’s consider a scenario to understand the prop-drilling problem and how Context API helps us to overcome it.
We have a state called Language defined in our App component which we need to pass to the Child Component 2 & 3 from the parent component. …
What is Socket.io?