React Router v4 Tutorial - #2 Routes & Links

preview_player
Показать описание
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!
Рекомендации по теме
Комментарии
Автор

The await (await fetch('....')).json() was cold as F***. Damn you're good!!

SimPwear
Автор

Quick question: If I wanted to configure this project to always launch json-server when run on http (localhost) but to read from a Postgresql DB when on https (or when finally deployed), how would I do that? Amazing series by the way.

matthewpointer
Автор

Hi, thanks for this tutorial, @ 2:25 when i type "yarn start" the server doesn't start, i'm using windows pc

msizindlela
Автор

also you can shorten <Fragment> with <> and </>

andrerothweiler
Автор

КомпОУнент, я тебя умоляю!!! Не компОнент. Дичайше режет ухо!

ArtiomNeganov