import { useMemo } from "react";
const memoizedValue = useMemo(() => {
return expensiveComputation(dependencies)
}, [dependencies]);
Next useMemo
Next TypeScript recipesReturns a memoized value.
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
Shortcut: next.hook.memo.use
0 Comments
Add Comment
Log in to add a comment