import { useMemo } from "react";
      
      const memoizedValue = useMemo(() => { 
        return expensiveComputation(dependencies) 
      }, [dependencies]);

      Typescript language logoNext useMemo

      next
      hook
      memo
      ...
      Next TypeScript recipes

      Returns 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

        Codiga - All rights reserved 2022.