3 ms·
> 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-upd
by shadowgovt 2y ago
> 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).
- acemarke 2y agoNote 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-structure https://redux.js.org/tutorials/essentials/part-2-app-structu... - https://redux.js.org/introduction/why-rtk-is-redux-today https://redux.js.org/introduction/why-rtk-is-redux-today