Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React Router v6 Basics!
You have completed React Router v6 Basics!
Preview
Letβs go over the key concepts you learned in this stage.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We learned a ton in this stage,
0:00
we found out that React doesn't
have built-in routing features.
0:02
So, many developers rely on
React Router to build single page apps
0:06
that dynamically load components and
0:10
change what's displayed in the browser
as a user navigates the app.
0:12
So we got started by installing React
Router to our app using the terminal.
0:17
Since our app runs in a web browser,
0:22
the very first React component we
used was the BrowserRouter component.
0:24
We nested our app component inside
BrowserRouter to help keep the UI in sync
0:29
with the URL.
0:33
Then we learned the basics of creating
routes and some of the benefits of
0:35
React Router's simple declarative
approach to writing routes.
0:39
By declarative,
0:43
I mean that React lets you write
the code that describes the end result.
0:44
For instance, the route's component
selects the route whose path
0:48
property best matches the URL and
loads the corresponding component.
0:52
All of this happens without you having
to define how it should happen.
0:57
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up