- import Loadable from 'react-loadable';
+ // $FlowFixMe: it is open issue on flow repo https://github.com/facebook/flow/issues/7093
+ import React, { lazy, Suspense } from 'react';
- const AsyncItemsSection = Loadable({
- loading: () => <LoadingIcon />,
- loader: () => import('./components/ItemsSection'),
- });
+ const AsyncItemsSection = lazy(() => import('./components/ItemsSection'));
+ <Suspense fallback={<LoadingIcon />}>
+ <AsyncItemsSection />
+ </Suspense>
Created
November 6, 2018 07:21
-
-
Save ThaddeusJiang/bb0301c366cadbfc720c54fc9ae52d81 to your computer and use it in GitHub Desktop.
code split with lazy and suspense form react 16.6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment