Skip to content

Dynamic & Catch-All Routing

Folders or files wrapped in single square brackets specify dynamic route parameters.

src/pages/
|-- user/
|-- [id].jsx --> /user/:id

Dynamic route parameters defined with [param] syntax (such as pages/user/[id].jsx) are passed automatically to your page components.

Select your framework below to see how parameters are received and accessed:

src/pages/user/[id].js
import { h1, p, div } from 'ziko'
export default function UserPage({ params }) {
return div(
h1('User Profile'),
p(`Viewing User ID: ${params.id}`)
)
}