There are some interesting Redux/React related repos worthy to dive into.
React components and decorators for putting context-like values into context and pulling them out as props
A isolated redux store is created for each React component instance. It has nothing to do with your global flux architecture.
There are four parts:
store.dispatch
to configure its actions, mapDispatchToActions
store.subscribe
to make sure that every acton fired would trigger the component’s setState(store.getState())
A utility to wrap many copies of a single Redux reducer into a single key-based reducer.
Since the actions in Redux is differentiated by action.type
, if we want to re-use the action
and reducer
of a specific (redux) component we need to hijack
the action.type
by tagging along a String Constant (like WRAPPEDBY=
) before it is dispatched. Meanwhile, we need the logic to help the related reducer to decipher the hijacked action.
In this way,
One way to think of it is as “nested Redux.” Each Realm component is its own mini-Redux app, which can be composed of other Redux apps.