Created
December 15, 2014 02:42
-
-
Save bingeboy/02f03a82a43fc48b11fb to your computer and use it in GitHub Desktop.
Reactjs Router
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
/** @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: ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gleaned from http://jsfiddle.net/L7mua/3/