Recently I've started working in a React-based project. I won't lie to you - I think React is just inherently wrong with the handicapped JSX syntax. There are better (faster) ways of dealing with templating than extending the underlying language syntax. But that is not all...
Looking at an average react project, what is immediately visible is a slew of walls of text. Nothing is made to look more SOLID. Not that it is not possible - quite the opposite. But the reality is that people take the simplest example that can possibly work and shove it in into production.
Essentially with the hooks (terrible idea, don't know why Vue has followed, probably only to get a bigger user base) everything is shoved into one, monstrous and enormous, function that gets executed over and over again, with no regard to single responsibility or open/closed principles. That makes the code not only hard to maintain, but above all a nightmare to maintain.
What that means is that React, in its simplest form (or even "on next.js") is just the beginning and even though you can force it to do your bidding it will require a lot of thought and extra code to make it DRY and SOLID.
I won't even try to take a stab at state management, because the way it's done in React should be punishable by life in prison (both hooks and setState()
)
On the other end of the spectrum is Angular. There you have everything automatically forcibly split into entities (components, modules, templates) regardless if you need it or not. That's good if you're writing a big app, but for small ones it is a massive overhead that you probably are never going to use.
Then, somewhere in between the two, we have Vue. Template separation? Check! Truly reactive state? Check! Small size bundle? Check and Recheck (Vue implements tree-shaking on directive level, so if you don't use e.g. v-model then it won't be in the final bundle)!
I know this is just me ranting about react (mostly) but in my humble opinion one should first learn to code (properly, meaning learning how good code looks like) and then and only then take a look at libraries/frameworks such as react, angular or vue. If you're going to start from React you're going to (most likely) be a bad-ass React developer after a few weeks - just like being jQuery-ninja :) It will not make you even a decent developer.
And then, knowing all the SOLID, DRY, SD and TDD you'll find another "React developer" telling you that it is OK to shove everything into one function - because that's the React-way because the docs say so :)
Happy coding!
Top comments (1)
good post Matthias, but want to notice that Vue didn't follow React hooks idea because Vue Composition API is a different thing on different level