Great article, I think this is mandatory knowledge for intermediate React developers. With the introduction of hooks, how might you add to this example for both memoizing a handler AND avoid recreating that memoized function on each render?
If I'm understanding hooks properly, this tutorial would not work.
Great article, I think this is mandatory knowledge for intermediate React developers. With the introduction of hooks, how might you add to this example for both memoizing a handler AND avoid recreating that memoized function on each render?
If I'm understanding hooks properly, this tutorial would not work.
Hey Dawson! Thanks for the reply. I realize this might be a bit late, but I think you could use a combination of
useCallback
andmemoize
:Perhaps there's a better or easier way using
useReducer
!