https://github.com/salvoravida/react-with-suspense-lazy
:tada: React lazy import with suspense. Easy alternative to react-loadable. Enable webpack chunks split.
https://github.com/salvoravida/react-with-suspense-lazy
chunks import lazy loadable react react-loadable split suspense webpack
Last synced: about 1 month ago
JSON representation
:tada: React lazy import with suspense. Easy alternative to react-loadable. Enable webpack chunks split.
- Host: GitHub
- URL: https://github.com/salvoravida/react-with-suspense-lazy
- Owner: salvoravida
- License: mit
- Created: 2019-10-18T10:40:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T04:58:34.000Z (about 2 years ago)
- Last Synced: 2025-03-28T09:51:31.946Z (about 2 months ago)
- Topics: chunks, import, lazy, loadable, react, react-loadable, split, suspense, webpack
- Language: JavaScript
- Homepage:
- Size: 301 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://www.npmjs.com/):$ npm install --save react-with-suspense-lazy
Or [yarn](https://yarnpkg.com/):
$ yarn add react-with-suspense-lazy
Usage
-----index.js
```javascript
import { withSuspenseLazy } from 'react-with-suspense-lazy'export const MyComponent = withSuspenseLazy(() => import('./MyComponent'));
```with loading fallback like spinners, etc...
```javascript
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!* :DContributors
------------
See [Contributors](https://github.com/salvoravida/react-with-suspense-lazy/graphs/contributors).License
-------
[MIT License](https://github.com/salvoravida/react-with-suspense-lazy/blob/master/LICENSE.md).