DEV Community

Fanny
Fanny

Posted on

React's weaknesses

In the last years, React has placed a lot of effort in improve many of it apis to be more easier and friendly to new comers. This happened with hooks, for example one of the motivations was because using classes components is so confused and complex for beginners, beyond the fact that until this point react had problems with reuse stateful logic. Although this exists, one really topic controversial and commented is about the state management in React, and the resistance generated in many developers to learn or use redux, because it is necessary to change a lot of files, and know many abstractions, yeah, we have the <Context> alternative, but do you think that this API is enough to complex things or global state management? or is it better to resort to redux?

My point is that I miss a more structured solution on this topic in React, Last days I was reading reddit and one of the maintaners of redux, it argued that with the library we would be able to have consistent architectural patterns, debugging capabilities and etc. And I agree with him, probably using the Context API and hooks, we'll suffering a lit bit to achieve these things.

Top comments (1)

Collapse
 
austindd profile image
Austin

People tend to push back against Redux because it asks the developer to invest more time upfront with some boilerplate code, and, more importantly, to recognize the functional programming patterns that Redux is based on.

As for boilerplate, I think people tend to overreact. I embrace boilerplate for the sake of good abstractions and clean architecture. Boilerplate can be your friend.

I don't know about others, but I spend way more time reading docs, thinking about how to solve hard problems, communicating ideas with my team, reviewing pull requests, and debugging errors... Boilerplate is just a mild annoyance in a vast sea of development work. I'm happy to do it if it means fewer hours spent on refactoring or debugging, or when it makes pull-requests seem more comprehensible.

As for understanding the FP concepts that Redux is based on, there really is no shortcut for learning fundamental principles of computer science & system design. There's no such thing as a library or framework that completely eliminates the need to think about abstraction layers like that. Developers should seek to level-up their understanding. Listen to talks on YouTube, read more articles, read books, do pair programming at work... whatever you have to do to learn. This stuff is considered "best practice" for a reason.

I want newcomers to succeed, and also avoid the mental overhead of building complex apps. But I'm not sure how realistic that is. Web programming is insanely complex nowadays. And all the tooling in the world can't change that. They only sweep complexity under the rug. And eventually you have to lift up the rug and deal with it. There's no way around that.

For non-trivial apps, Redux is a hugely beneficial tool. I suggest people use it, or at least something like it. They will be better off down the road.