Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useMemo

/*
Pass a “create” function and an array of dependencies. 
useMemo will only recompute the memoized value when one 
of the dependencies has changed. This optimization helps 
to avoid expensive calculations on every render.
*/
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
Source by reactjs.org #
 
PREVIOUS NEXT
Tagged: #useMemo
ADD COMMENT
Topic
Name
5+6 =