Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var App = React.createClass({
- render: function(){
- var Child;
- switch(this.props.route)
- {
- case 'about':
- Child = about;
- break;
- default:
- Child = Home;
- break;
- }
- return (
- <div>
- <Child/>
- </div>
- );
- }
- });
- function render(){
- var hashRoute = window.location.hash.substr(1);
- ReactDOM.render(<app route = {hashRoute} />, document.getElementById('app'));
- }
- window.addEventListener('hashChange', render);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement