React - Memoization hooks

React virtual DOMDocs and hooks dependency arrays heavily relies on comparing of the properties.

We need to create function or complexed structure like array or object during rendering, each time the new object will be created.

To reduce number of rerenders and effect calls we can use memoization techniques. It is Important to remember that optimization is not always needed and should be used wisely

useCallback usage

I use useCallback hook to create memoized version of functions that will only update when its dependencies will be altered

useMemo usage

I know how I can create memoized variables with useMemo and that this technique is really usefull when dealing with costly calculations

React.memo

I know that memo is completely different from useMemo hook and can be used to memoized version of whole component and prevent rerenders when data is not changed

Icon of React
Icon of Memoization hooks
React skill
core
Memoization hooks
Ready to learn
Required technologies

I use useCallback hook to create memoized version of functions that will only update when its dependencies will be altered

I know how I can create memoized variables with useMemo and that this technique is really usefull when dealing with costly calculations

I know that memo is completely different from useMemo hook and can be used to memoized version of whole component and prevent rerenders when data is not changed

Close
Loading content