Use `useActionState` in a Client Component to bind a Server Action and expose its returned state: ```tsx const [state, formAction, pending] = useActionState(action, initialState) return <form action={formAction}>...</form> ``` The action should return a serializable success/error state, validate inputs, authenticate/authorize, and revalidate after success. Use `pending` for disabled controls; keep redirects and thrown errors in the action’s expected control flow rather than swallowing them.
Installs into .claude/skills of the current project.
Are you the author of Nextjs Server Actions?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-nextjs-server-actions-d0abaea6)
Use `useActionState` in a Client Component to bind a Server Action and expose its returned state:
```tsx
const [state, formAction, pending] = useActionState(action, initialState)
return <form action={formAction}>...</form>
```
The action should return a serializable success/error state, validate inputs, authenticate/authorize, and revalidate after success. Use `pending` for disabled controls; keep redirects and thrown errors in the action’s expected control flow rather than swallowing them.