File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,36 @@ These routes then need to be added to the routes file for the parent tools/utils
272
272
Simply adding the routes to one of thes files above will register the tool/util
273
273
with the application and will display the new component.
274
274
275
+ ### Lazy loading and code splitting
276
+
277
+ When loading a route component, please use the ` lazyLoad() ` method defined in the application lib.
278
+
279
+ | param | description|
280
+ | ----- | ---------- |
281
+ | ` moduleImport: () => Promise<any> ` | Function which imports the desired module |
282
+ | ` namedExport?: string ` | The name of the exported module (if the module has named exports) |
283
+
284
+ Eg:
285
+ ```
286
+ // Lazy load the WelcomePage component
287
+ const WelcomePage: LazyLoadedComponent = lazyLoad(() => import('./welcome'), 'WelcomePage')
288
+ ...
289
+ // Use the component as route element
290
+ export const learnRoutes: Array<PlatformRoute> = [
291
+ {
292
+ children: [
293
+ {
294
+ children: [],
295
+ element: <WelcomePage />,
296
+ ...
297
+ },
298
+ ...
299
+ ]
300
+ }
301
+ ]
302
+ ```
303
+
304
+
275
305
### Platform Route
276
306
277
307
The PlatformRoute model has several useful options:
You can’t perform that action at this time.
0 commit comments