React’s upcoming compiler will not solve prop-drilling, but Signals do
Example: an application where the state is stored at a common ancestor of two child components that render and mutate the state.?
We need to pass the state (and setter) down through prop-drilling. This is the same for Signals as it is for `useState()`.
Even if we assume that everything is memoized through React Forget Compiler, the state prop-drilling will require that all of the components in that branch re-render.
In contrast, Signals are independent of the render tree and can directly update the needed component.
The key insight is that `useState()` is tied to the component tree, but Signals are independent of the component tree.
It's hard not to be excited about signals.
Softwareentwicklung, Management, Nachhaltigkeit
1 年I heard the conversation about Qwick and other things with you on the Syntax Podcast. Thanks a lot for this nice talk. I found this exciting after hearing about Signals also in Solid.js. It sounds so plausible and handy to me to update the state with a getter right there and only there, exactly at the point where it is used. At the same time, I'm a big React fan. I still don't quite understand: Is it basically possible to integrate signals into React, or does the architecture of the library not allow it at all?
Front-end engineer, ReactJS+ Frameworks, Accessibility Engineer, CSS/SASS/, UX/UI Developer, Software Instructor
1 年Neat! I thought I saw at a glimpse of a useSignal hook? I’m on mobile now but I’ll try to look it up