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:
Figure 5.2 – Unhandled path
So, nothing is rendered beneath the header when we browse to a path that isn't handled by a
Routecomponent. 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
Routescomponent:<Routes> Â Â <Route path="" element={<HomePage/>} /> Â Â <Route path="search" element={<SearchPage/>} /> Â Â <Route path="ask" element={<AskPage/>} /> Â Â <Route path="signin" element...