useNavigate

Returns an imperative method for changing the location. Used by <Link>s, but may also be used by other elements to change the location.

See also

https

://reactrouter.com/v6/hooks/use-navigate