r/reactjs • u/GianniMariani • Oct 17 '26
React state hooks are footguns
If you take software engineering principles seriously then none of the react state hooks belong inside a react component.
I think one of the most critical things you should do is ensure the decoupling of storage and UI components. The react components force you to do is precisely and zustand doesn't help.
I haven't sourced grip-react a year ago and I've been using it exclusively, absolutely zero usestate usememo, useeffect, etc and absolutely zero prop drilling. I don't know why anyone would want to do something different, honestly.
Has anyone else created an API that is a 100% replacement with complete declarativeness? I looked at angular and mobx, they're close but no cigar.
4
u/michaelobriena Oct 17 '26
Yikes!
1
u/Top_Bumblebee_7762 Oct 17 '26
useState seem unavoidable (unless you use useReducer instead everywhere) in any react app.
3
u/TheChickenKingHS Oct 17 '26
I’m not sure if this is a misunderstanding of a functional component, a ui component or JSX as a concept and I’m just curious as to which…
3
u/rafark Oct 17 '26
Principles and good practices evolve. I’m not saying react is perfect but after some time you realize software can have many valid forms
2
u/azangru Oct 17 '26
Why are you using this horrible library then, if it creates so many footguns?
You haven't?
2
u/_Feyton_ Oct 17 '26
Just use vanila JS at that point bro, don't let the bundler limit you king🙏🙏🙏
0
u/[deleted] Oct 17 '26
[deleted] — view deleted comment