慕盖茨4494581
import React from 'react'import { render } from 'react-dom'const About = React.createClass({/*...*/})const Inbox = React.createClass({/*...*/})const Home = React.createClass({/*...*/})const App = React.createClass({getInitialState() { return { route: window.location.hash.substr(1) }},componentDidMount() { window.addEventListener('hashchange', () => { this.setState({ route: window.location.hash.substr(1) }) })},render() { let Child switch (this.state.route) { case '/about': Child = About; break; case '/inbox': Child = Inbox; break; default: Child = Home; } return ( App About Inbox )}})render(, document.body)