Be the first user to complete this post
|Add to List|
Automating Store and Action registration for multiple components using Fluxxor
quick start guide shows you how you register actions and stores beforehand. Although its an effective strategy, its not scalable because it is difficult to identify all the stores and actions that the sub-components on a page are going to require at the time of defining the top level component, the place where your instantiate your flux object. This also implies that you would have to edit your top level component to register a new store whenever a component is added that depends on a store. The situation gets even more complicated if you allow components to register stores by themselves at runtime because it is possible that different components might depend same store and therefore it is wise to only have one place to register a store. If only we could have a way to allow each component to mention the stores it depends on, and then the runtime would take care of registering them if not already registered.
FluxContextMixin since it helps in constructing the flux context by adding stores and actions as necessary.
Our objective is to use this mixin on any component that depends on other Fluxxor stores and actions. And by simply listing out the stores and actions in the statics, the mixin would automatically register them in the flux context if they were not already registered.
Below is an example of a component that would use our
[wpgist id="44898ab1dac0b8d5d396" file="MyComponent.js"]
- Using React with Backbone Models
- Generating container components with connect utility in react redux app
- Pass props to the handler component in react-router
- Execution sequence of a React component's lifecycle methods
- Pass down props using React childContextTypes in a deeply nested component tree
- Passing the store down implicitly via context in a react redux app
- Uncaught TypeError: Cannot read property 'toUpperCase' of undefined in React
- Reactjs flux architecture - Visualized