Skip to content

Instantly share code, notes, and snippets.

@sehmaschine
Created June 23, 2015 13:24
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 sehmaschine/c86c1ad694fe2d489a1c to your computer and use it in GitHub Desktop.
Save sehmaschine/c86c1ad694fe2d489a1c to your computer and use it in GitHub Desktop.
react router context
var NavigationView = React.createClass({
childContextTypes: {
router: React.PropTypes.func.isRequired
},
showGroups: function(event) {
React.render(<NavigationGroup />, document.getElementById('menu'));
},
render: function() {
return (
<div id="parent">
<a href="javascript://" onClick={this.showGroups}>
</div>
);
}
});
var NavigationGroup = React.createClass({
contextTypes: {
router: React.PropTypes.func.isRequired
},
render: function() {
return (
<div id="child">
Link to="group/11/">Testlink</Link>
</div>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment