Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 555 Bytes

README.md

File metadata and controls

33 lines (21 loc) · 555 Bytes

use-action-state

A react hook that simplifies usage of react server actions. The hook adds error handing and loading states.

Example

const [run, { error, loading }] = useActionState(action);

...

await run()

Full API

const [run, { error, loading, data }] = useActionState(action);

...

const { data, error } = await run()

Installation

yarn add use-action-state
npm install use-action-state