3 ms·
Interesting ideas! However many of these would make reasoning about React and state a lot more difficult. Especially if the component tree can have root element
by zsims 5y ago
Interesting ideas! However many of these would make reasoning about React and state a lot more difficult. Especially if the component tree can have root elements swapped out but keep children.
Feels like we're trending back to two way binding
- unconed 5y agoIt's the exact opposite: the work arounds people come up with to solve the Tree problem described in the post is a two way binding, which is already difficult to reason about. The model with continuations restores one way data flow, making it easy to reason about again. The useEffect/setState rerendering catastrophe is exactly hard to reason about because it involves lots of intermediate states nobody wants. Most people don't realize this is what happens either. Again, more difficult than just having initial render and subsequent render both update immediately. The morph problem is so subtle, most cases I encounter, people don't even realize their entire app is remounting when the route changes. Their mental model of React is wrong, it's too optimistic. Morph is entirely safe to do. It sounds like you either skimmed it superficially, or don't understand what it's trying to teach. I have dealt with a lot of junior react devs in the last few years, and IMO the react team has a few blind spots which you run into when you try to make desktop-quality software with it. Look inside complex react libraries and you find they are completely ignoring all the supposed rules, so they can present an actual workable API on the outside.