New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More โ†’
Socket
Sign inDemoInstall
Socket

react-client-async

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-client-async

React tools for async rendering in client side! ๐Ÿš€

  • 1.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-99.15%
Maintainers
0
Weekly downloads
ย 
Created
Source

โš›๏ธโณ
React Async for Client

๐ŸŽฌ Demo ยท ๐ŸŒŸ GitHub ยท ๐Ÿ“ฆ Package

๐Ÿ‘‹ Introduction

This package helps you use async function without the need to migrate to โš›๏ธ React 19 and server-side rendering!

  • โœจ Supports utility hooks to create and render async tasks.
  • โœจ Supports AbortSignal and automatic abort on re-render.

๐Ÿš€ Install

npm i react-client-async

โœ… useAsync Hook

You can use the useAsync hook to create a task.

console.log(useAsync(promiseFn, args, options));

โœ… Async Component

You can use the Async component to render an async component.

<Async
  $fc={fc} // may be an async function component
  $waiting={waiting} // waiting component
  $fallback={fallback} // fallback component
  {...props} // props for the function component
/>

๐ŸŽฌ Demo of Recursive Async Component

Easy to wrap a recursive async component and memoize it.

const Rec: FC<{ n: number }> = wrap(
  async ({ [$signal]: signal, n }) =>
    // break the recursion
    (n <= 0) ? 0 : (
    // delay and recursion
      <>
        {await delay(99, signal)}
        {n} <Rec n={n - 1} /> {n}
      </>
    )
);

โณ What is Next?

  • โณ useAsyncIterable hook
  • โณ AsyncIterable component
async function* IterableComponent() {
  yield* OtherIterableComponent();
  yield  await component1();
  yield  await component2();
  yield  <div>...</div>;
}

Looking forward to your feedback or contribution! ๐Ÿš€๐Ÿš€๐Ÿš€

Development

Install

  • Install bun runtime: npm install -g bun
  • Install dependencies: bun install

Run & Build

  • Run demo: bun dev
  • Build demo: bun build:app
  • Build package: bun build:lib

Deploy

  • Deploy demo to github pages: bun build:app:deploy
  • Publish this package to npm: bun build:lib:publish

Keywords

FAQs

Package last updated on 06 Feb 2025

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc