use-action-state
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i use-action-state

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    2.27 kB

    Total Files

    4

    Last publish

    Collaborators

    • henninghall