Upgrading to 0.6.0
Breaking changes
Route factories
Replace createRoutes with an array of individual createRoute calls. Replace nested children arrays with a parent reference, and include each navigable route in the router's array. The same change applies to createExternalRoutes, which becomes createExternalRoute.
ts
// Before
const routes = createRoutes([
{
name: 'users',
path: '/users',
children: createRoutes([
{
name: 'detail',
path: '/[id]',
component: UserPage,
},
]),
},
])
// After
const users = createRoute({
name: 'users',
path: '/users',
})
const detail = createRoute({
parent: users,
name: 'detail',
path: '/[id]',
})
const router = createRouter([users, detail])See Routes and External Routes.
Route option and param helper types
The old RouteProps, ParentRouteProps, ChildRouteProps, and RoutePropsWithMeta types are removed. Use the new CreateRouteOptions for factory inputs and infer created route types from createRoute.
Param extraction aliases and guards formerly re-exported from the package are no longer available. Infer param values from a resolved route's params rather than importing ExtractParamType, ExtractParamTypes, or ExtractRouteParamTypes.