In this tutorial, we’ll be learn how to use useMemo hook in React JS. This is the Seven part of React JS Tutorials in Hindi. In React.js, the useMemo hook is used to memorize the result of a computation. Memorization is an optimization technique that involves caching the result of a function so that if the same inputs occur again, the cached result can be returned instead of recalculating the result. This can be particularly useful when dealing with expensive computations or calculations that don’t need to be recomputed every time a component renders.
In this example, the memorized result will only be recalculated when the plus changes, not when the minus changes. This can help optimize performance by avoiding unnecessary computations.