Appendix A. React Router 4 basics
This appendix covers
- Using declarative routing in your components
- Using configurable routing to create a single source of truth
- Moving code from React Router 3 lifecycle events into a higher-order component
- Prefetching data in the browser by using a higher-order component
React Router 4 represents a big change in thinking from React Router 3. It moves from a standard static router implementation in which you define your routes in a single file to a dynamic implementation in which routes are created within React components. This also allows you to move most lifecycle logic out of React Router lifecycle methods and into React’s lifecycle. Let’s start by reviewing how you switch your components over to use React ...