Summary
In this chapter, we first learned how the React Router library works and which components it consists of. Then, we set up the library and an index route for the home page of our blog (showing a feed of blog posts). Next, we defined a new route to show a single post on a separate page and used the Params Hook to get the id
value from the URL. Then, we learned how to navigate to this new route and back to the home page using Link
and NavLink
components. Finally, we learned how to programmatically navigate after a post was successfully created by using the Navigation Hook.
In the next chapter, we are going to learn about advanced built-in Hooks that React provides.