Let's test your knowledge. Fill in the missing part by typing it in.
In React Router, you can use the __ component to implement redirects. It allows you to define a specific path and URL you want to redirect users to. For example, to redirect users from the '/login' route to the '/dashboard' route, you can use the following code:
JAVASCRIPT
1import { Redirect } from 'react-router-dom';
2
3function LoginPage() {
4 const isLoggedIn = true; // Replace with your authentication logic
5
6 return (
7 <div>
8 {isLoggedIn ? <Redirect to='/dashboard' /> : <LoginForm />}
9 </div>
10 );
11}
Write the missing line below.