Summary
React Router gives us a comprehensive set of components for managing the navigation between pages in our app. We learned that the top-level component is BrowserRouter
, which looks for Route
components within a Routes
component beneath it where we define what components should be rendered for certain paths. The path
in a Route
component that best matches the current browser location is the one that is rendered.
The useParams
hook gives us access to route parameters, and the useSearchParams
hook gives us access to query parameters. These hooks are available in any React component under BrowserRouter
in the component tree.
We learned that the React lazy
function, along with its Suspense
component, can be used on large components that are rarely used by users to load them on demand. This helps the performance of the startup time of our app.
In the next chapter, we are going to continue building the frontend of the Q&A app, this time focusing on implementing forms.
...