Using React Router 4

Wrapup

Wrapup

Over the course of these videos, we have taken multiple pages that use React to display content and weaved them all together with the help of react-router-dom. It has made the process really easy. We had some high level components we could use, such as Route, Redirect, and Link. If those didn't give us the control we wanted, we could use the objects passed into our Routes as props to get this control. These include the history and match objects.

We didn't cover everything there is to know about React Router. There is another prop passed in to all Routes called location that can give you information about the current URL you are at. There are also a few other types of routers that are exported that give you different functionality when navigating around, such as HashRouter and MemoryRouter. We also didn't cover the high level component withRouter that allows any component to have access to the match, history, and location props without them needing to be explicitly passed down.

Feel free to find me on the Scotch.io slack channel and ask questions or just talk! My username is searsaw.