navigation

Implements type-safe navigation, preloading, and blocking patterns in TanStack Router applications.

Updated May 26, 2026
One-click install
npx skills add https://github.com/Albo-Club/albo-os --skill navigation-albo-club
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: navigation
Source: https://github.com/Albo-Club/albo-os/tree/main/.agents/skills/tanstack-router-core/navigation
Command: npx skills add https://github.com/Albo-Club/albo-os --skill navigation-albo-club

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-router.

What problem does it solve? Building navigation in a TanStack Router app involves many APIs—Link, useNavigate, preloading, blocking, scroll restoration—and misusing them breaks type safety, accessibility, or user experience. This Skill provides correct, type-safe patterns for every navigation scenario. ## Core Features & Use Cases - Type-Safe Links and Navigation: Use Link with params, activeProps, relative from paths, and useNavigate for programmatic redirects without breaking type inference. - Preloading and Performance: Configure intent, viewport, or render preloading strategies with preloadDelay and stale-time control. - Navigation Guards and UX: Block navigation on unsaved forms with useBlocker, restore scroll positions, and show pending UI with MatchRoute. - Use Case: You are building a dashboard with a nav bar, an edit form that warns before leaving, and links that preload on hover—this Skill gives you the correct pattern for each. ## Quick Start Add a type-safe Link to /posts/$postId with active styling and intent preloading in my TanStack Router app.

Frequently Asked Questions about navigation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a type-safe Link with dynamic params in TanStack Router?

Pass the route path with $ segments to the `to` prop and supply values via the `params` object, e.g. <Link to="/posts/$postId" params={{ postId }}>. Never interpolate params into the `to` string, as that breaks type safety and param encoding.

How to preload routes on hover in TanStack Router?

Set defaultPreload: 'intent' on createRouter, or add preload="intent" per Link. Preloaded data stays fresh for 30 seconds by default; set defaultPreloadStaleTime to 0 when using an external cache like TanStack Query.

When should I use useNavigate vs Link in TanStack Router?

Use Link for anything the user clicks, since it renders a real anchor with href, accessibility, and preloading. Use useNavigate only for programmatic navigation after side effects like form submissions or async actions.

How do I block navigation when a form has unsaved changes?

Use the useBlocker hook with a shouldBlockFn that returns true when the form is dirty. Add withResolver: true to get proceed, reset, and status for rendering a custom confirmation dialog instead of window.confirm.

Why does my relative Link with '..' navigate to the wrong route?

Without a `from` prop, relative paths like '..' resolve from the root route instead of the current one. Pass from={Route.fullPath} so relative navigation resolves against the current route and stays type-safe.

Why does updating search params remove my existing query string?

Passing search as a plain object replaces all existing search params. Use the function form search={(prev) => ({ ...prev, page: 2 })} to merge new values with the current search state.