Skip to main content
useNavigate is a React hook that provides programmatic navigation within your AppShell application. It’s re-exported from react-router v7 and is essential for navigating between pages in response to user actions.
Always import useNavigate from @tailor-platform/app-shell, not from react-router directly. AppShell manages its own router instance, and importing from the wrong package will cause navigation to fail.

Usage

Signature

Examples

Basic Navigation

Use replace: true to replace the current history entry instead of adding a new one:
Pass data to the destination route using the state option:
Use negative numbers to navigate backward in history:

Dynamic Routes with Params

Type-Safe Navigation with Generated Routes

When using file-based routing with the Vite plugin, you can generate type-safe route helpers:
See Type-Safe Navigation for setup instructions.

Common Patterns

Conditional Navigation

See Also