Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@gao-sun gao-sun released this 26 Jul 04:26
· 1 commit to master since this release
bec641e

A simple and safe way to use React.lazy when you are iterating React app fast. It will catch the error and automatically retry to import or refresh the page when a lazy React component fails to load.

Installation

npm i react-safe-lazy
  • Direct dependencies: 0.
  • Peer dependency: react@^18.0.0.

Usage

Just replace React.lazy with safeLazy and you are good to go.

import { safeLazy } from 'react-safe-lazy';

const MyComponent = safeLazy(() => import('./MyComponent'));

Note

Please check README for more details.