Created
April 8, 2019 21:05
-
-
Save cdaz5/c11d416f7052c0df6f6eac3096568a43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1: | |
import React, { lazy, Suspense } from 'react'; | |
Step 2: | |
// change this: | |
import BusinessList from 'screens/businesses/list'; | |
// to this: | |
const BusinessList = lazy(() => import('screens/businesses/list')); | |
Step 3: | |
// wrap switch in <Suspense> and provide a fallback (in this a loader). | |
<Suspense fallback={<Loader />}> | |
<Switch> | |
// ...routes | |
</Switch> | |
</Suspense> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment