Socket
Book a DemoInstallSign in
Socket

async-boundary

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-boundary

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

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
37
428.57%
Maintainers
1
Weekly downloads
 
Created
Source

<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

Keywords

suspense

FAQs

Package last updated on 20 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.