更改之后出现问题,是引用版本错误吗?

来源:1-4 运用ReactRouter开发一个单页APP

Coding青天

2019-04-18 17:03

<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>


写回答 关注

1回答

  • 慕少5011530
    2019-11-19 23:50:41

    很可能是版本问题 一部分需要从ReactRouterDom中引入吧

React知识点综合运用实例

react综合案例操作,技能掌握更纯熟

18253 学习 · 12 问题

查看课程

相似问题