React lazy import with suspense. Easy alternative to https://github.com/jamiebuilds/react-loadable
Enable webpack chunks split.
Using npm:
$ npm install --save react-with-suspense-lazy
Or yarn:
$ yarn add react-with-suspense-lazy
index.js
import { withSuspenseLazy } from 'react-with-suspense-lazy'
export const MyComponent = withSuspenseLazy(() => import('./MyComponent'));
with loading fallback like spinners, etc...
import { withSuspenseLazy } from 'react-with-suspense-lazy'
import Loading from './Loading';
export const MyComponent = withSuspenseLazy(() => import('./MyComponent'), Loading);
Let me know what do you think about!
Enjoy it? Star this project! :D
See Contributors.