Skip to content

Commit

Permalink
docs: 馃摎锔廰dded missing selector function in async components (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
lourensdev committed Jul 13, 2021
1 parent e7794c8 commit 2bb4bc7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions docs/building-blocks/async-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ export const HomePage = lazyLoad(
In this case, the app won't show anything while loading your component. You can, however, make it display a custom loader with:

```ts
import * as React from 'react';
import React from 'react';
import { lazyLoad } from 'utils/loadable';

export const HomePage = lazyLoad(() => import('./index'), {
fallback: <div>Loading...</div>,
});
export const HomePage = lazyLoad(
() => import('./index'),
module => module.HomePage,
{
fallback: <div>Loading...</div>,
}
);
```

Make sure to rename your `Loadable.ts` file to `Loadable.tsx`.
This feature is built into the boilerplate using React's `lazy` and `Suspense` features.

0 comments on commit 2bb4bc7

Please sign in to comment.