Chapter 9. Handling Navigation with Routes
Almost every web application requires routing. It is the process of responding to a given URL, based on a set of route configurations. A simple mapping, in other words, from the URL to rendered content. However, this simple task is more involved than it seems at first. This is why we're going to leverage the react-router
package in this chapter, the de facto routing tool for React.
First, you'll learn the basics of declaring routes using JSX syntax. Then, we'll dig into the dynamic aspects of routing, such as dynamic path segments and query parameters. Next, you'll implement links using components from react-router
. We'll close the chapter with an example that shows you how to lazy-load your components as the URL changes.