shadcn-ahooks

useAsyncEffect

useEffect support async function.

Overview

useEffect support async function.

Documentation and Examples

Installation

Open in
pnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useAsyncEffect.json
npx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useAsyncEffect.json
yarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useAsyncEffect.json
bun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useAsyncEffect.json

useEffect support async function.

代码演示

Default usage

Break off

API

function useAsyncEffect(
  effect: () => AsyncGenerator | Promise,
  deps: DependencyList
);

On this page