feat: add redirect on index page of components

This commit is contained in:
p-sw 2024-06-01 02:59:25 +09:00
parent 5635888066
commit 9580007a10

View File

@ -3,6 +3,7 @@ import {
createBrowserRouter, createBrowserRouter,
createRoutesFromElements, createRoutesFromElements,
RouterProvider, RouterProvider,
redirect,
} from "react-router-dom"; } from "react-router-dom";
import MainLayout from "./MainLayout"; import MainLayout from "./MainLayout";
import Home from "./Home"; import Home from "./Home";
@ -19,6 +20,9 @@ const router = createBrowserRouter(
<Route path="/docs" element={<DocsLayout />}> <Route path="/docs" element={<DocsLayout />}>
<Route index element={<DocsIntroduction />} /> <Route index element={<DocsIntroduction />} />
<Route path="installation" element={<DocsInstallation />} /> <Route path="installation" element={<DocsInstallation />} />
<Route path="components">
<Route index loader={() => redirect("/docs/components/button")} />
</Route>
</Route> </Route>
</Route> </Route>
) )