Hooks: useMemo and useCallback In React
By Sahas Purkuti 2022-06-02 09:11:10
In this article, we will be discussing the two in-built react hooks: useMemo and useCallback. Whenever there is an update in a component, react re-renders. This may cause unchanged parts of the components to re-render unnecessarily. So, to avoid these types of unwanted re-render of the whole component tree, we use useMemo and useCallback. We implement the memoization method. It is an optimization method that stores the results of expensive functions and returns the cached results when a similar scenario takes place.