Removing the dependency array in useEffect #29
Replies: 2 comments
-
|
Great question! You are right that the compiler's analysis gives us a solid foundation to automatically figure out dependencies. What's hard about this is not the compiler implementation, but more so the overall design of effects. We're looking at it holistically across both the runtime and compiler. It's not baked enough for us to share concrete details at this point in time, but this is something we're well aware of and have been doing a lot of active research on. Several of us are working on the useEffect space currently. I hope we can share more soon! |
Beta Was this translation helpful? Give feedback.
-
|
Curious about the status of this @poteto, especially given this blog post from earlier this year:
The post makes it seem like the compiler can already do this, but as far as I can tell, it doesn't do this and the blog post is misleading. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What are the plans for using the React Compiler to remove the need for having a dependency array in
useEffect?It feels like it would be pretty easy to have the compiler automatically inject all the right dependencies, and surely this has been discussed internally. Although I guess there are backwards compatibility issues with the fact that not having a dependency array currently means running the effect after each render.
Beta Was this translation helpful? Give feedback.
All reactions