Skip to content

Instantly share code, notes, and snippets.

@joecritch
Created July 8, 2014 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joecritch/0bf7855bfc58df8c7f06 to your computer and use it in GitHub Desktop.
Save joecritch/0bf7855bfc58df8c7f06 to your computer and use it in GitHub Desktop.
Using Flux in react-nested-router
/**
* @jsx React.DOM
*/
var React = require('react');
var App = require('components/App/App.jsx');
var Layout = React.createClass({
render: function() {
var node = this.props.flux ? App : React.DOM.div;
return (
<node flux={this.props.flux}>
{this.props.activeRoute}
</node>
);
}
});
module.exports = Layout;
// .... << dependency set up >> ....
var flux = new Fluxxor.Flux(stores, actions);
React.renderComponent(
Route({handler: Layout, flux: flux},
Route({name: 'home', path: '/', handler: Home, flux: flux})
)
)
@joecritch
Copy link
Author

This is an attempt to use Fluxxor within react-nested-router. Layout handles the rendering of the App component once this.props.flux is passed from the router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment