1.Router Switch
Switch can have any React Component inside it
- Route
- User defined Component
- Redirect
2. Wrapper Component
Redirection Logic can be reused by separating out into a React Component called Wrapper Component. Each route will be wrapped with it.
2.1 Protected Route
ProtectedRoute is the Wrapper Component which returns Home Route Component.
File: src/components/ProtectedRoute/index.js
JSX