1. 程式人生 > >react-router初用

react-router初用

這裡寫圖片描述

安裝: npm install react-router-dom –save

<Provider store={store}>
        <BrowserRouter>
            <div>
                <ul>
                    <li>
                        <Link to='/'>一營</Link>
                    </li>
                    <li>
<Link to="erying">二營</Link> </li> <li> <Link to="sanying">三營</Link> </li> </ul> <Route path="/" exact component={App}
>
</Route> <Route path="/erying" exact component={Erying}></Route> <Route path="/sanying" exact component={Sanying}></Route> </div> </BrowserRouter> </Provider>