项目作者: salvoravida

项目描述 :
:tada: React lazy import with suspense. Easy alternative to react-loadable. Enable webpack chunks split.
高级语言: JavaScript
项目地址: git://github.com/salvoravida/react-with-suspense-lazy.git
创建时间: 2019-10-18T10:40:44Z
项目社区:https://github.com/salvoravida/react-with-suspense-lazy

开源协议:MIT License

下载


react-with-suspense-lazy

React lazy import with suspense. Easy alternative to https://github.com/jamiebuilds/react-loadable

Enable webpack chunks split.

Installation

Using npm:

  1. $ npm install --save react-with-suspense-lazy

Or yarn:

  1. $ yarn add react-with-suspense-lazy

Usage

index.js

  1. import { withSuspenseLazy } from 'react-with-suspense-lazy'
  2. export const MyComponent = withSuspenseLazy(() => import('./MyComponent'));

with loading fallback like spinners, etc…

  1. import { withSuspenseLazy } from 'react-with-suspense-lazy'
  2. import Loading from './Loading';
  3. export const MyComponent = withSuspenseLazy(() => import('./MyComponent'), Loading);

Feedback

Let me know what do you think about!

Enjoy it? Star this project! :D

Contributors

See Contributors.

License

MIT License.