useNavigate
Edit this pageRetrieves the method which accepts a path to navigate to and an optional object with the following options:
- resolve (boolean, default 
true): resolve the path against the current route - replace (boolean, default 
false): replace the history entry - scroll (boolean, default 
true): scroll to top after navigation - state (any, default 
undefined): pass custom state tolocation.state 
const navigate = useNavigate();
if (unauthorized) {  navigate("/login", { replace: true });}Info: 
The state is serialized using the structured clone algorithm which does not support all object types.