$chiubaca / notes / fleeting / 2021-02-15
  • Learning more about how the useCallback react hook works in practice. The first argument is a callback function, the second argument is an array of props or state which the the hook is “watching”, it keeps the current values of this data in memory. Only if the value has changes will the callback function be executed.
  • Wrap your functions in React.memo to ensure that the component only re-renders if the props have changed. This provide a small perfomrance benefit.
Edit on GitHub ✏️

Hey I'm Alex Chiu 👋. These are my notes for literally anything.

I'm using the Zettelkasten method to organise my thoughts here.

My more polished writings are published to my main blog at chiubaca.com

Follow me on: Github / X (Twitter) / Mastodon / LinkedIn