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

> I haven't seen a code base that used a context for shared state that could be updated from descendant nodes.

I use this pattern commonly. You put a state-update callback into the context.

It's my favorite go-to when I don't want to bother writing all that Redux boilerplate (state description plus accessors plus reducers feels... Half-baked).



Note that Redux usage patterns have changed significantly since 2019. Modern Redux with our official Redux Toolkit package is drastically simpler and easier to use than the original legacy hand-written patterns:

- https://redux.js.org/tutorials/essentials/part-2-app-structu...

- https://redux.js.org/introduction/why-rtk-is-redux-today




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

Search: