Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

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.

See this [blog post](https://blog.logto.io/react-safe-lazy/?ref=github) for the motivation of this library and implementation details.

## Installation

```bash
Expand Down Expand Up @@ -92,6 +94,9 @@ const safeLazy = createSafeLazy({
});
```

> [!NOTE]
> In the above example, the `safeLazy` function will retry importing the component 3 times for each page load, which means that the import function will be called at most 4 * 3 = 12 times before giving up.

## License

MIT