| ▲ | danabramov 7 hours ago | |||||||
>React’s approach is very inefficient - the entire view tree is rerendered when any change happens. That's not true. React only re-renders down from where the update happens. And it skips over stuff that is provably unchanged -- which, fair, involves manual memoization hints. Although with React Compiler it's actually pretty good at automatically adding those so in practice it mostly re-renders along the actually changed path. >And the code to do diffing and reconciliation is insanely complicated. It's really not, the "diffing" is relatively simple and is maybe ~2kloc of repetitive functions (one per component kind) in the React source code. Most of complexity of React is elsewhere. >The solidjs / react model uses the compiler to figure out how variables changing results in changes to the rendered view tree. I actually count those as "React-like" because it's still declarative componentized top-down model unlike say VB6. | ||||||||
| ▲ | josephg 2 hours ago | parent [-] | |||||||
> That's not true. React only re-renders down from where the update happens. And it skips over stuff that is provably unchanged -- which, fair, involves manual memoization hints. React only skips over stuff that's provably unchanged. But in many - most? web apps, it rerenders a lot. Yeah, you can add memoization hints. But how many people actually do that? I've worked on several react projects, and I don't think I've ever seen anyone manually add memoization hints. To be honest it seems a bit like Electron. People who really know what they're doing can get decent performance. But the average person working with react doesn't understand how react works very well at all. And the average react website ends up feeling slow. > Most of complexity of React is elsewhere. Where is the rest of the complexity of react? The uncompressed JS bundle is huge. What does all that code even do? > I actually count [solidjs / svelte] as "React-like" because it's still declarative componentized top-down model unlike say VB6. Yeah, in the sense that Solidjs and svelte iterate on react's approach to application development. They're kinda React 2.0. Its fair to say they borrow a lot of ideas from react. And they wouldn't exist without react. But there's also a lot of differences. SolidJS and Svelte implement react's developer ergonomics, while having better performance and a web app download size that is many times smaller. Automatic fine grained reactivity means no virtual dom, no vdom diffing and no manual memoization or anything like that. They also have a trick that react is missing: Your component can just have variables again. SolidJS looks like react, but your component is only executed once per instance in the page. Updates don't throw anything away. As a result, you don't need special react state / hooks / context / redux / whatever. You can mostly just use actual variables. Its lovely. (Though you will need a solidjs store if you want your page to react to variables being updated). | ||||||||
| ||||||||