Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ = jQuery = require('jquery');
var React = require('react');
var Home = require('./components/homePage');
var About = require('./components/about/aboutPage');
var App = React.createClass({
render: function() {
var Child;
switch (this.props.route) {
case 'about':
Child = About;
break;
default:
Child = Home;
}
return (
<div>
<Child />
</div>
);
}
});
function render() {
var route = window.location.hash.substr(1);
React.render(<app route={route} />, document.getElementById('app'));
}
window.addEventListener('hashchange', render);
render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.