<script type="text/babel"> var { Router, Route, IndexRouter, IndexLink, Link, hashHistory }=ReactRouter; var destination=document.querySelector('#container'); var Home=React.createClass({ render:function () { return( <div> <h2>望天门山</h2> <p>天门中断楚江开,碧水东流至此回</p> <p>两岸青山相对出,孤帆一片日边来</p> </div> ); } }); var APP=React.createClass({ render:function () { return( <div> <h1>Simple SAP</h1> <ul className='header'> <li>李白</li> <li>杜甫</li> <li>李商隐</li> </ul> <div className="content"> {this.props.children} </div> </div> ); } }); ReactDOM.render( <Router history={hashHistory}> <Route path="/" component={APP}> <IndexRouter component={Home}/> </Route> </Router>, destination ); </script>
很可能是版本问题 一部分需要从ReactRouterDom中引入吧