Developer Preview Feature
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Pass a RouterConfig object to the createRouter() API to create a router for specific routes.
| Property | Type | Required/Optional | Description |
|---|---|---|---|
routes | Array | Optional | An array of route definitions. If you don’t specify a RouteDefinition array, the default value is an empty array. If you don’t specify a value for RouterConfig.routes, the router can’t match any locations. |
basePath | String | Optional | A path prefix applied to all URIs for the router. If you don’t specify a base path, the default value is "". |
caseSensitive | Boolean | Optional | If true, URIs are processed case sensitively. The default value is false. |
i18n | Array | Optional | An i18n config that may affect the path prefix applied to all URIs. The default value is {locale: 'en-US', defaultLocale: 'en-US'}. |
1type RouterConfig = {
2 routes?: RouteDefinition[],
3 basePath?: string,
4 caseSensitive?: boolean,
5 i18n?: {
6 locale: string;
7 defaultLocale: string;
8 },
9};1routes: [
2 {
3 id: 'home',
4 uri: '/'
5 handler: () => import('example/homePageHandler'),
6 page: {
7 type: 'home',
8 },
9 },
10 {
11 id: 'namedPage',
12 uri: '/:pageName',
13 handler: () => import('example/namedPageHandler'),
14 page: {
15 type: 'namedPage',
16 attributes: {
17 pageName: ':pageName',
18 },
19 },
20 }
21 ],
22 basePath: '/my-site',
23 i18n: {
24 locale: 'es',
25 defaultLocale: 'en-US'
26 },
27 caseSensitive: trueDeveloper Preview Feature