Post

I found some of the limitations put on this a little unexpected, especially the requirement to not pass the callback in props into other components. Well the last time I needed something like useEffectEvent, these limitations would've been no issue, but I wonder if that will generally be the case.

0 reposts1 like

conceptually an Effect Event is like a block of code inside an Effect, kind of like event { … } the API is a bit of like writing the compiled output for that

the API is powerful because it completely turns off reactivity for the code inside. however, that’s also very dangerous if used all over the place because you don’t know where along the chain reactivity might disappear. the constraints prevent that

not quite because you *have to* declare dependencies in useCallback. and it doesn’t “see” latest props/state on its own