3 ms·
Writing React code is "easy" because it's what's been mainstreamed. A lot of developers now will learn building UIs with React before learning how to do the sa
by CharlieDigital 2y ago
Writing React code is "easy" because it's what's been mainstreamed. A lot of developers now will learn building UIs with React before learning how to do the same with vanilla.
Writing good, performant React code at scale is hard because the model of how reactivity works is "inverted"[0] from how we normally think about reactive code because React points the callback to the component and thereby requiring this dance to move the state out and then back in on re-render (which it does excessively). And thus the name "hook" because you can visualize the state moving out and back on re-render.
This inversion is also why state is harder on React, why it needs the double-render strict mode to flush out issues from mis-placed state and over-renders, and why performance will always be mediocre until they change models of reactivity.
The compiler now is 2 years+ in the making and hasn't shown any signs of actually improving much of anything. The alternatives are more than just viable, they offer both better DX and better performance with perhaps the biggest gap being React Native, which may shortly be addressed by LynxJS[1]
[0] https://chrlschn.dev/blog/2025/01/the-inverted-reactivity-model-of-react/ https://chrlschn.dev/blog/2025/01/the-inverted-reactivity-mo...
[1] https://lynxjs.org/ https://lynxjs.org/