0.1.1 • Published 3 years ago

async-boundary v0.1.1

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

<AsyncBoundary>

CI

A React async-boundary that couples an error-boundary as well as a suspense container

⚙️ Install

yarn add async-boundary

🚀 Usage

import { AsyncBoundary } from 'async-boundary';

const SuspensfulContainer = () => {
  return (
    <AsyncBoundary>
      <SlowSuspensfulComponent />
    </AsyncBoundary>
  );
};

const SlowSuspensfulComponent = () => {
  const data = resource.data.read();

  return <h1>{data.thing}</h1>;
};

Please read more about suspense at Concurrent React (Suspense for Data Fetching)

🔎 API

AsyncBoundary: FunctionComponent

Props

  • fallback: The ReactChild to render whilst Suspending
  • errorFallback: The ReactChild to render when an error occurred.
    • Has a retryFn callback passed to it, calling it will remount the <AsyncBoundary> children.
  • onError: The componentDidCatch callback.

License

MIT © Marais Rossouw

0.1.0

3 years ago

0.1.1

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

5 years ago