Created
November 23, 2021 02:23
-
-
Save arinthros/8312245cdcba27cd0828ca1f13720588 to your computer and use it in GitHub Desktop.
React Router v6 nesting example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Route, Routes } from 'react-router-dom' | |
function AppRoutes() { | |
return ( | |
<Routes> | |
<Route index={true} element={<Home />} /> | |
<Route path="settings" element={<Settings />}> | |
<Route path="people" element={<PeopleSettings />}> | |
<Route path=":userId" element={<PersonSettings />} /> | |
</Route> | |
<Route path="types" element={<TypesSettings />}> | |
<Route path=":typeId" element={<TypeSettings />} /> | |
</Route> | |
<Route path="security" element={<SecuritySettings />} /> | |
</Route> | |
<Route path="items/:storageId" element={<Storage />}> | |
<Route path=":itemId" element={<StorageItem />} /> | |
</Route> | |
</Routes> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment