Creates a react component that ensures the flux context type is passed down to the child components. This method is provided for convenience, your own wrapper can be used as desired
/**
* @param {String} name optional custom name for the context
*/
var ContextWrapper = fluxapp.createWrapper('ApplicationContext');
// alternatively
var context = fluxapp.createContext();
context.wrapper // ContextWrapper
React.createClass({
displayName: 'MyContextWrapper',
PropTypes: {
handler: React.PropTypes.element.isRequired,
context: React.PropTypes.object.isRequired,
},
childContextTypes: {
flux: React.PropTypes.object.isRequired,
},
getChildContext: function() {
return {
flux: fluxapp.createContext(),
};
},
render: function() {
var Component = this.props.handler;
var props = _.omit(this.props, 'handler');
return React.createElement(Component, props);
}
});
On to Plugins