2022-12-6 router的配置写法

49 阅读1分钟

image.png

image.png

{useRoutes(routes)} 在对应位置根据传入routes渲染路由表
useRoutes帮我们把传入的routes进行遍历,本质还是
<Routes>
  <Route path="" element={}>
  </Route>
</Routes>

image.png