HIDE PLAYLIST
1
Download in HD10s25s

Conditionally Render a React Router v4 Route with the Switch Component


We often want to render a Route conditionally within our application. In React Router v4, the Route components match the current route inclusively so a “stack” of Routes will all be processed. To render a single Route exclusively we can wrap them in the Switch component to render the first Route that matches our current URL.

Find the code for this lesson on Github

The branch name corresponds to the lesson.

FIND THE CODE ON GITHUB