wouter-vue Documentation

useParams

Get route parameters from the current route.

Description

Returns a reactive Ref<RouteParams> containing all route parameters extracted from the current location. Parameters are automatically merged from parent routes when using nested routing.

Returns

Where RouteParams is:

Important Note

useParams() always returns a reactive Ref. Even if no route parameters are present, it returns ref({}), ensuring consistent reactivity behavior.

Example

Nested Routes

When using nested routes, parameters are automatically merged:

Access via Props

Route parameters are also available as props when using :component prop:

Built with wouter-vue • GitHub