3 ms·
UseEvent RFC: Hook for event handlers with an always-stable function identity
- tomduncalf 4y agoI’ve not thought too deeply about how this will work in practice, but seems like a good step towards solving the confusing situation with the useEffect dependency array needing to contain things that you don’t actually want to the effect to re-run for (which I think could perhaps have been designed better up front, I find it pretty confusing to deal with and I’ve been doing React for over 8 years…)
- Cthulhu_ 4y agoI am... more and more disliking React for making me have to think about performance as much. I don't want to have to wrap click handlers in useCallback() or useEvent(). I don't want to have to wrap components in react.Memo. It feels like that's a lot of extra boilerplate and mental overhead that I think the framework should manage for me.
- terandle 4y agoThey are working on a compiler (React Forget) that will automate all of the memoization stuff for you. So at some point down the road I expect we'll be able take our current components and just delete all of the useCallback/useMemo code.
- jwalton 4y agoNice idea. Terrible name. I can think of many places I’d use this that have nothing to do with events.