This video explains how to render an error page when a user goes to an invalid URL.
- [Instructor] Hi, in the last video,…we set up React-Router and created a new favorites page.…In this video, we are going to see…how to render a 404 component when the core of your route…doesn't match any of the routes that we defined.…And to do that, we're going to make use…of a new React-router component called Switch.…So the Switch is basically a React-router helper component…that makes it possible to render just one route…of the one that you define inside of favorites.…And this route is going to be the first one…that matches the current location.…But the order in which you put the routes…inside the switch matters.…
So the way we're going to use this is by defining…a new route at the end of the switch.…If you're trying to go to the home,…the first route will match…and will only render the home component.…If you are to route to your favorites page,…the second route will match.…However, if we add a new route with no path at all,…that route is going to match any URL you're currently on.…So we're sure that we will also show something on-screen,…
- 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: 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.