Post

tried writing this blog 3 times but it’s really boring, so here’s the short version: React won. Every mainstream f/w now implements its ideas, and developed their own ecosystems. The ones that didn’t, lost and died. This implies there’s no _strong_ reason to not pick one of the other winners.

I still genuinely don't know what "React adopt signals" would _mean_ at a technical level. Per other comments in this thread, React works at the component level. What would a hypothetical native-to-React signals integration do differently?

It would have to have been something new. Breaking likely. Signals would allow: - finer grained updates than “component” e.g. jsx fragments - state/data flow that isn’t tied to component hierarchy and doesn’t need to rerender (or subscribe to a store to rerender) itself and its children

for change detection. - useMemo/useCallback would actually only get used for heavy computations instead of referential stability Just spitballing here. But look at Preact signals for more ideas.

0 reposts6 likes

The cynical reason why this never happened in React would be because it devalues React. If you don't need components to build complex trees of state, you barely need components at all. And then you barely need react at all. Working on React or a React FW subconsciously biases away from that.

You still need components for the domain modeling benefits. So signals let you re-render at the element level? That’s pretty neat. Guess you could do that by composing even smaller components but that probably gets unwieldy 🤔

You don't have to re-render elements though, and it would skip the necessity to "compare nodes" e.g. if you have <input value={textSignal} />, it would only have to update `value` and skip the entire process React is currently doing.

The domain modelling thing is 50/50 - you can do it elegantly in signals using function or class composition, which is pretty nice compared to the mess of hooks since your functions/classes are purely factories/constructors and never re-run. You just need components for the view, and even then...

Behind the scenes if you use a signal in an element position in JSX it gets interpreted as a tiny self-updating component in React and Preact. Attributes and text bind directly to DOM.