by austin-cheney · 1mo ago · 0 comments
Component systems are the new OOP. They are numerically complex. People think they are all the rave and I don't know why, but then people also think OOP is generally all the rave and I don't think they know why.
You don't need component systems, but if you choose to go down that path just realize everything is far more work because there is tremendous amounts of duplication both explicitly in your logic and under the hood where you are not looking. Most people who believe they need this are locked into an enormous framework and deliberately avoid looking under the hood, because its a giant scary beast they believe they cannot live without.
If you want simple you will do everything in your power to avoid component systems, because simple does not mean easy. Rich explains it better in what might be the best computer science talk ever given: Simple Made Easy
React is actually more functional than anything else.
Of course if you actually try to be pure functional many developers will scream at you “prop drilling! Code smell!” But to me that it is a much lesser evil than useContext() and what is essentially global variables
The only language/framework that is truly functional in that sense is Elm.
I get this isn't everyone, and not everyone has the luxury to work in settings where this is a nonissue, but in those settings it sounds like the technology is being used as a restraint jacket for dysfunctional organisation.
When its been a problem, its always because the organisation was dysfunctional, "design" and "engineering" was what people did post humorously to justify spending time on their hobby horse.
Like 99% of components I've written project props on into other components and interpret them in purely. I often manage application state in external stores, which are decoupled from the view.
But I'm talking about interactive UIs which need state, as the environment its running in (the browser) is inherently stateful, and there are efficiency gains from doing so.
This isn't just an OOP thing, even in Elm & Purescript there are similar libraries for stateful UI. In you're doing anything like that in Closure or Clojurescript or whatever, I guarantee you its built on similar data structures and its foundation has many equilivant constructs.
My large SPA achieves full page load with state restoration in under 150ms. You don’t need React or components to achieve simplified state management.