和之前的0.x版用法不太一样,这里写了个小例子做下笔记.
var Router = ReactRouter.Router; var Route = ReactRouter.Route; var App = React.createClass({ render () { return ( <div> <h1>App</h1> </div> ) } }); var App2 = React.createClass({ render () { return ( <div> <h1>App2</h1> </div> ) } }); ReactDOM.render(( <Router> <Route path="/app1" component={App}/> <Route path="/app2" component={App2}/> </Router> ),document.getElementById("main"));