Problem Statement
What is the difference between <Navigate> and <Redirect> in React Router?
Explanation
<Redirect> was used in React Router v5 for navigation. In React Router v6, it was replaced with <Navigate>. <Navigate> is a declarative way to redirect users to another route programmatically and is simpler to use with hooks and state.
Code Solution
SolutionRead Only
<Navigate to='/home' replace />
Practice Sets
This question appears in the following practice sets: