Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To me, actions is the insight in the reducer approach popular in React community. Actions and reducers force you to clearly define the logic of what can happen in a way that keeps it decoupled from the UI or some global state. When used properly, this actually helps arrive at a better and more sustainable design overall.

I’m working on a somewhat complex app and for a long time was sticking to plain useState and contexts, and lately I’m finding that moving it to a reducer (plain React, no Redux) has positive effects on architecture.

That said, the devil’s in the details—I personally think the approach is sometimes misused, including sadly certain tutorial materials. I’m reasonably new to reducers though.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: