useNavigate Hook in React

From the TanStack Router cheat sheet · Navigation & Links · verified Jul 2026

useNavigate Hook

Programmatic navigation

typescript
import { useNavigate } from '@tanstack/react-router'

const navigate = useNavigate()

navigate({ to: '/posts' })

navigate({
  to: '/posts/$postId',
  params: { postId: '123' }
})
💡 Use for programmatic navigation
⚡ Type-safe params and search
🔍 Supports relative paths (./edit, ..)
🎯 replace option for history control
navigateprogrammatichook

Continue with TanStack Router

Save the full cheat sheet or work through every related task.

More React tasks

Back to the full TanStack Router cheat sheet