react-with-suspense-lazy

0.4.5 • Public • Published

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:

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

Or yarn:

$ yarn add react-with-suspense-lazy

Usage

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);

Feedback

Let me know what do you think about!
Enjoy it? Star this project! :D

Contributors

See Contributors.

License

MIT License.

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i react-with-suspense-lazy

    Weekly Downloads

    68

    Version

    0.4.5

    License

    MIT

    Unpacked Size

    13.1 kB

    Total Files

    13

    Last publish

    Collaborators

    • salvoravida