| Maybe, but in my experience whenever I encounter an incomprehensible mess of hooks it usually ends up because devs were not using all the tools that react provides. For example a flurry of setStates could be wrapped up in one single state. If it gets too complex - into a reducer. Components that don’t benefit much from splitting up could have their business logic wrapped into a context, and let the view code be just jsx without all the interweaving of code and templates. Maybe the one benefit of classes was like it forced you to think in business logic, then render. React still has that, you just need to dive a bit deeper into its toolbox. The result usually turns out much more flexible - contexts neatly wrap business logic for all of its descendants, classes don’t. I think this was maybe because react actually allows you to write messy code, and it’s still performant and works. But in the end it just kinda postpones the inevitable maintenance burden. I guess solid.js from the looks of it might postpone it a bit more. I just worry that solid looks more like magic, and some invariant somewhere will just break and I wouldn’t know what sequence of reactions actually led to that infinite loop that crashed the page. Haven’t tried it myself though, might more understandable in the end… |
You've just deoptimized your app, and your whole component will re-render on every change.
> Components that don’t benefit much from splitting up could have their business logic wrapped into a context
You did it again. More unnecessary re-renders.
> it’s still performant and works
True that 'it works', but it's usually not as performant as you think - we just have really fast computers and phones now.