Post

unless refs changed while i wasn’t looking you need to wrap this in `useCallback`, otherwise it’ll call both the cleanup and setup function again every single render

It should work the same though

0 reposts1 like

Hmm isn't it the same as having a useEffect without dependency array, and then adding an empty one to it? That changes st which time / how often it runs.

What’s the use case for needing to run every render? Seems like a hacky way to do side effects in render