Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/floydjones1/react-lazy-retry


https://github.com/floydjones1/react-lazy-retry

Last synced: 12 days ago
JSON representation

Awesome Lists containing this project

README

        

# react-lazy-retry

This is a lazyRetry that wraps Reacts lazy loading function.
Implementation below

## Geting started

```
// npm
npm intall @tdotcode/react-lazy-retry

// yarn
yarn add @tdotcode/react-lazy-retry
```

## Usage

1. This will retry 5 times spaced out for 1 second between retries

```javascript
import React from "react";
import lazyRetry from "@tdotcode/react-lazy-retry";
const Greeting = lazyRetry(() => import("./components/Greeting"));

function App() {
return (



);
}
```

2. You can also control number of retries and duration between retries.
In this example we are retrying 10 times spaced out for 100ms

```javascript
import React from "react";
import lazyRetry from "@tdotcode/react-lazy-retry";
const Greeting = lazyRetry(() => import("./components/Greeting"), 10, 100);

function App() {
return (



);
}
```