I have my app routes in a file like this:
<Route path='/' element={<Home />}>
<Route index path='/' element={<Feed />} />
<Route path='friends' element={<Friends />}>
<Route index element={<>asd</>} />
<Route path='friend-request' element={<>12</>} />
<Route path='blocked-friends' element={<>ccc</>} />
<Route path='add-friends' element={<AddFriends />} />
</Route>
<Route path="saved" element={<>Saved</>} /> */}
</Route>
This gets very messy and was thinking of creating separate sub routes components to make it neater like this:
<Route path='/' element={<Home />}>
<Route index path='/' element={<Feed />} />
<FriendsRoutes />
<Route path="saved" element={<>Saved</>} /> */}
</Route>
Where FriendsRoutes is a component with these routes:
<Route path='friends' element={<Friends />}>
<Route index element={<>asd</>} />
<Route path='friend-request' element={<>12</>} />
<Route path='blocked-friends' element={<>ccc</>} />
<Route path='add-friends' element={<AddFriends />} />
</Route>
But when I do this I get this error:
Uncaught Error: [FriendsRoutes] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
Any Idea how to solve this?