MENU
useNavigate
The useNavigate hook returns a navigate function that lets you change the current location programmatically – in a click handler, after a form submits, or inside an effect – instead of only through a rendered <Link>. It replaces the useHistory hook and its underlying 'history' object from older versions of React Router.
Don't confuse this with useNavigation() – despite the similar name, that hook does the opposite job: it's a read-only object describing a navigation that's already in progress, not a function you call to start one.