gloriaJun / til

Lessoned Learned
3 stars 0 forks source link

Full dynamic import component with @loadable/component #65

Open gloriaJun opened 4 years ago

gloriaJun commented 4 years ago
import loadable from '@loadable/component';

const AsyncLoadablePage = loadable(props => import(`@components/${props.page}`), {
  cacheKey: props => props.page,
});

// ...SKIP
 <Switch>
    <Route path={MAIN.GOOD_BYE} component={() => <AsyncLoadablePage page="bye/Bye" />} />
</Switch>