Closed
Description
Consider following code (live demo at http://jsfiddle.net/raem6o6z/)
var RouteHandler = React.createClass({
render: function() {
return React.DOM.div({}, this.props.foo ? 'Is foo' : 'Is not foo');
}
});
var App = React.createClass({
getInitialState: function() {
return {foo: true};
},
componentDidMount: function() {
var self = this;
setTimeout(function() {
self.setState({foo: false});
console.log('setting state');
}, 2000);
},
render: function() {
return ReactRouter.Routes({},
ReactRouter.Route({
handler: RouteHandler,
foo: this.state.foo
}));
}
});
React.renderComponent(App(), document.getElementById('app'));
After setting the state App::render
is called as well as RouteHandler::render
but the props on RouteHandler are not updated, they still point to the initial values.
Is this expected (documented?) behavior? And if so is there something I can do about it. I need to pass changed stuff to the route handlers.
Metadata
Metadata
Assignees
Labels
No labels