0

I have a react component that uses some hooks. The component will call hooks with parameters and get a value back.

Is there a way to only execute the hook if the parameter is different from the previous value just like how we can use React.memo() on the component itself and avoid rerendering if the props are the same?

user5507535
  • 1,580
  • 1
  • 18
  • 39
  • Can you share some code? – devpolo Apr 06 '23 at 09:30
  • This seems like a duplicate of this [https://stackoverflow.com/a/61438672/12036438](https://stackoverflow.com/a/61438672/12036438) – criccode Apr 06 '23 at 09:43
  • 1
    Does this answer your question? [How to memoize custom React hook](https://stackoverflow.com/questions/61438517/how-to-memoize-custom-react-hook) – criccode Apr 06 '23 at 09:44

0 Answers0