const App = () => {
return (
<Router>
<div>
<ul>
<li>
<Link to="/page">Login</Link>
</li>
<li>
<Link to="/page1">Page 1</Link>
</li>
<li>
<Link to="/page2">Page 2</Link>
</li>
<li>
<Link to="/page3">Page 3</Link>
</li>
</ul>
<Routes>
<Route path="/page" element={<Login></Login>} />
<Route path="/page1" element={<Page1></Page1>} />
<Route path="/page2" element={<RequestPage></RequestPage>} />
<Route path="/page3" element={<DemoComponent></DemoComponent>} />
</Routes>
</div>
</Router>
);
};
export default App;
React路由及导航的简单使用
最新推荐文章于 2024-08-24 07:00:00 发布