useNavigate



Imperative navigation hook.

Returns a stable navigate(options) function to change the current location programmatically. Prefer the Link component for user-initiated navigation, and use this hook from effects, callbacks, or handlers where imperative navigation is required.

Options:

  • from: Optional route base used to resolve relative to paths.

API Docs

Return

A function that accepts NavigateOptions.