

React normally re-renders a component whenever its parent re-renders. UseMemo is a React Hook, that caches the result of a computationally expensive function between re-renders and allows to trigger the method only when the method dependencies changes. Usage Skipping re-rendering when props are unchanged. Memo is a Higher Order Component in React (If you want to learn about HOCs you can check out our detailed guide on HOC in React) that prevents the re-rendering of the component if its props are unchanged. Dead Simple Chat is a highly scaleable Chat Platform that can be used for any chat use case. We will do a deep dive into these performance optimization options offered by React and look at their difference and see in what cases memo and useMemo should be used.ĭead Simple Chat JavaScript Chat API and SDK allow you to add chat to your React application in minutes. The useMemo hook memoizes values in your React application. Also check the post Your Guide to eCallback () if you'd like to read about useCallback () hook. Given the same a, b dependencies, once memoized, the hook is going to return the memoized value without invoking computation (a, b). The React useMemo hook is one tool you can use to improve the performance of your React apps. useMemo ( () > computation (a, b), a, b) is the hook that lets you memoize expensive computations. In this blog post, we will look at the memo and useMemo in React. Performance is important, especially in large-scale application.
