Handling routes not found
In this section, we'll handle paths that aren't handled by any of the Route
components. By following these steps, we'll start by understanding what happens if we put an unhandled path in the browser:
- Enter a path that isn't handled in the browser and see what happens:
So, nothing is rendered beneath the header when we browse to a path that isn't handled by a
Route
component. This makes sense if we think about it. - We'd like to improve the user experience of routes not found and inform the user that this is the case. Let's add the following highlighted route inside the
Routes
component:<Routes> Â Â <Route path="" element={<HomePage/>} /> Â Â <Route path="search" element={<SearchPage/>} /> Â Â <Route path="ask" element={<AskPage/>} /> Â Â <Route path="signin" element...