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 beneath it where we define what components should be rendered for certain paths. We can use the exact prop to instruct React Router to do a full match rather than a partial match, which it does by default.

RouteComponentProps gives us access to route parameters and query parameters via the match and location objects, respectively. We discovered that React Router doesn't parse query parameters for us, but can use the native JavaScript URLSearchParams function to do this for us. RouteComponentProps also gives us access to a history object, where we can perform navigation programmatically. The Link component allows us to link to different pages declaratively in JSX.

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.211.193