From a6760c9bfc6d3b6057098903dfa85b4070078995 Mon Sep 17 00:00:00 2001 From: dawnmist Date: Sat, 14 Oct 2017 13:00:21 +1100 Subject: [PATCH] Add an example for use with typescript. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index d97d0c8..0f7185b 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,16 @@ export default asyncComponent({ }); ``` +If you're using typescript, you may need to explicitly return the default import from your resolve function, like so: + +```tsx +import { asyncComponent } from 'react-async-component'; + +export default asyncComponent({ + resolve: () => System.import('./Product').then((product) => product.default) +}); +``` + I recommend that you use the following folder/file structure: ```