use-action-state
v0.0.2
Published
A react hook that simplifies usage of <a href="https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions">react server actions</a>. The hook adds error handing and loading states.
Downloads
4
Readme
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