When using useState, to persist the same state across renders without causing re-renders, you can use the ________.

  • useCallback
  • useEffect
  • useMemo
  • useRef
When using useState, to persist the same state across renders without causing re-renders, you can use the useCallback hook. This hook memoizes the provided function, ensuring that it doesn't change between renders unless its dependencies change. This can be useful for optimizing performance when passing callbacks to child components.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *