Learn how to define redirects declaratively using react-router.
- [Instructor] Hi, in this video we are going…to talk about redirects.…Redirects are pretty straight forward.…It's a just way of saying that when a user goes…to a particular URL it should be redirected to a new one.…Direct router exports a redirect component…that enables us to do this in a very declarative way.…You just have to pass two different routes…to this component.…The first one is the from property,…that specifies from where where we want to redirect a user.…The second one is the to property…and defines the target URL of that redirection.…Remember that in our application,…we now have two different routes.…
The first one is a route path that…renders the home component.…And the second one is the favorite path…that renders the favorite component.…However, we also want to be able to go to the home…by typing slash home in our browser.…So let's add a redirect for that.…Go to your code editor and import redirect…from React router dom.…Once you do that, you will just have to create…a new redirect component inside our switch statement.…
- Structuring React projects
- Creating and mounting the root component
- Composing components for more complex UI
- Using state to making components dynamic
Skill Level Intermediate
React.js: Building an Interface (2016)with Ray Villalobos1h 21m Intermediate
React: Managing Complex Interactionswith Emmanuel Henri1h 45m Intermediate
1. How to Structure React Projects
2. Diving into the First Components
3. Styling Made Easy
5. Painless Components Testing
Configure Jest5m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.