Skip to content

Instantly share code, notes, and snippets.

@joecritch
Created July 8, 2014 12:08
Show Gist options
  • Select an option

  • Save joecritch/0bf7855bfc58df8c7f06 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown
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