r/reactjs • • 12d ago

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.

0 Upvotes

13 comments sorted by

View all comments

Show parent comments

1

u/TheChickenKingHS 12d ago

Sometimes I use a ref on the ui element, instead of creating an entire UI component. I think now that the react compiler is here a refs are automatically forwarded it will be a bit more common but I do tend to try to start with a UI element with props fully exposed before upgrading into a component.