1.0.5 • Published 3 years ago

@tdotcode/react-lazy-retry v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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
import React from "react";
import lazyRetry from "@tdotcode/react-lazy-retry";
const Greeting = lazyRetry(() => import("./components/Greeting"));

function App() {
  return (
    <Suspense fallback={null}>
      <Greeting />
    </Suspense>
  );
}
  1. You can also control number of retries and duration between retries. In this example we are retrying 10 times spaced out for 100ms
import React from "react";
import lazyRetry from "@tdotcode/react-lazy-retry";
const Greeting = lazyRetry(() => import("./components/Greeting"), 10, 100);

function App() {
  return (
    <Suspense fallback={null}>
      <Greeting />
    </Suspense>
  );
}
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago