Skip to content

Instantly share code, notes, and snippets.

@bingeboy
Created December 15, 2014 02:42
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 bingeboy/02f03a82a43fc48b11fb to your computer and use it in GitHub Desktop.
Save bingeboy/02f03a82a43fc48b11fb to your computer and use it in GitHub Desktop.
Reactjs Router
/** @jsx React.DOM */
var App = React.createClass({
getInitialState: function() {
return {currentPage: 'home'};
},
componentDidMount: function() {
var router = Router({
'/home': this.setState.bind(this, {currentPage: 'home'}),
'/bio': this.setState.bind(this, {currentPage: 'bio'})
});
router.init();
},
render: ...
});
@bingeboy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment