React Router v4 Tutorial - #2 Routes & Links

Published: 05 March 2018
on channel: Code Realm
16,917
137

Moving on, let's set up React Router in our app. First, we'll need to render the built-in BrowserRouter as the root component in our tree. With the web router in place, we can start adding Link components that will help us navigate around without page reload. Lastly, to match our client-side routes, we'll use the Route component. Define the pathname under the path prop, and then instruct the router to render some content in response to that path being matched, by either supplying it a "render" or a "component" prop.

All three (BrowserRouter, Link, Route) are React components and can be rendered with JSX tags. That means no static routing, no route config files, no hustle. Sweet!


Watch video React Router v4 Tutorial - #2 Routes & Links online without registration, duration hours minute second in high quality. This video was added by user Code Realm 05 March 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 16,91 once and liked it 13 people.