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