Route Meta Fields and Typing
meta: { requiresAuth: true }, TypeScript declaration merging for typed meta.
What Are Route Meta Fields?
Every route can carry a meta object: arbitrary data attached to the route. It is perfect for flags like authentication requirements, allowed roles, page titles, or layout choices.
Adding Meta to a Route
Set the meta key on a route record. The values are entirely up to you.
const routes = [
{
path: '/dashboard',
component: Dashboard,
meta: { requiresAuth: true, roles: ['admin', 'editor'] }
}
]All lessons in this course
- Route Meta Fields and Typing
- Route Transitions and Animation
- Scroll Behavior Configuration
- Programmatic Navigation and useRouter