Chapter 9: Handling Navigation with Routes
Almost every web application requires routing: the process of responding to a URL, based on a set of route handler declarations. In other words, this is a mapping from the URL to rendered content. However, this task is more involved than it seems at first. This is why you'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, you'll learn about the dynamic aspects of routing, such as dynamic path segments and query parameters. Next, you'll implement links using components from react-router
.
Here are the high-level topics that we'll cover in this chapter:
- Declaring routes
- Handling route parameters
- Using link components