Created
July 4, 2016 17:02
-
-
Save rBurgett/8ed7cf06b7aa12285d4d2b9e6a45a182 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// changes to APP.js | |
var APP = React.createClass({ | |
... | |
render() { | |
return ( | |
<div> | |
<Header title={this.state.title} status={this.state.status}/> | |
{/* | |
The thing with React Router is that it only passes props into its children. | |
This makes sense for applications with stateless components using Redux | |
as the data store. But if you want to pass down state, you need to explicitly | |
add the state data to the children. When I add the title property from state | |
here, you can now access it through this.props.title in the child component. | |
*/} | |
{React.cloneElement(this.props.children, {title: this.state.title})} | |
</div> | |
) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very astute, got me past that hurdle. Thanks.