Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
import { useNavigate } from "react-router";function SomeComponent() { let navigate = useNavigate(); return ( <button onClick={() => { navigate(-1); }} /> );} Copy
import { useNavigate } from "react-router";function SomeComponent() { let navigate = useNavigate(); return ( <button onClick={() => { navigate(-1); }} /> );}
It's often better to use redirect in actions and loaders than this hook.
Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects.
It's often better to use redirect in actions and loaders than this hook.