I've got the fairly typical react-router app set up:
var App = React.createClass({
render: function() {
return ( < RouteHandler /> );
}
});
var routes = (
<Route handler = { App }>
< Route name = "Todo" path = "todo/:id" handler = {Todo}/>
< DefaultRoute name = "Todos" handler = {Todos}/>
</Route>
);
Router.run(routes, function(Handler) {
React.render( < Handler /> , document.getElementById('content'));
});
My issue is that my Todos
component has some search filters on it, and I want to persist those filters when I transition to a specific Todo
and back. The obvious solution is to save those filter values on App
's state, but I can't figure out an elegant way to allow Todos
access to App
's state.
Any hints?
Addendum: This app is using Reflux as well as react-router.