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