router-core/path-params

Define and consume dynamic URL parameters in TanStack Router routes.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/abereghici/skills --skill router-core-path-params-abereghici
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/path-params
Source: https://github.com/abereghici/skills/tree/main/skills/tanstack-router/path-params
Command: npx skills add https://github.com/abereghici/skills --skill router-core-path-params-abereghici

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Path parameters are essential for capturing dynamic URL segments in TanStack Router-based applications. This skill explains how to define and consume dynamic segments, splat routes, optional params, and prefix/suffix patterns to build flexible, strongly-typed routes.

Core Features & Use Cases

  • Dynamic Segments: Capture named segments with a leading $ in the route path.
  • Splat & Optional Params: Use _splat for catch-all and {-$param} for optional segments, enabling versatile routing.
  • Params Usage: Access params via Route.useParams(), and handle i18n/locale patterns with optional locale routes.
  • Use Cases: Build routes like /posts/$postId, /teams/$teamId/members/$memberId, or internationalized routes with locale prefixes.

Quick Start

Create a route like /posts/$postId and read the dynamic postId with Route.useParams() in your component.

Frequently Asked Questions about router-core/path-params

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

FAQPage Schema
How do I capture dynamic URL segments in TanStack Router?

To capture dynamic URL segments in TanStack Router, define routes with a leading $ in the path, such as /posts/$postId. You then read these dynamic path parameters within your component using the Route.useParams() hook to drive UI state and navigation.

How do I handle optional parameters and splat routes in TanStack Router?

TanStack Router handles optional parameters and splat routes using specific syntax. Use the _splat keyword for catch-all routing and the {-$param} syntax for optional segments, enabling versatile and strongly-typed dynamic path matching.

How do I build internationalized routes with optional locale path parameters?

To build internationalized routes, apply i18n-aware routing concepts using optional locale path parameters. By leveraging optional params like {-$param}, you can prefix paths with locale segments and parse them to drive localized UI state and navigation.

How do I access parsed route parameters in a TanStack Router component?

You access parsed route parameters in a TanStack Router component by calling Route.useParams(). This hook retrieves the dynamic values parsed from URL segments, splats, and optional params, allowing you to use them directly in your UI logic.

Can I use prefix and suffix patterns when defining dynamic route paths?

Yes, you can use prefix and suffix patterns when defining dynamic route paths in TanStack Router. These patterns work alongside dynamic segments, splats, and optional params to create flexible matching rules across nested and internationalized routes.