Skip to content

Commit

Permalink
docs: Correct useFormStatus to be a client component (#50991)
Browse files Browse the repository at this point in the history
### What?

The `useFormStatus` needs to be used in a client component. That
component should be used within a `form` for the `pending` property to
reflect the form status.

### Why?

The docs are currently not accurate.

### Notes

I could also update the name of the file to not be `form.js`, which
implies this is the entire form instead of just the submit button being
used as a component within the form.
  • Loading branch information
ethanmick committed Jun 8, 2023
1 parent 61a5539 commit 9a08206
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ export function Thread({ messages }) {
The **experimental** `useFormStatus` hook can be used within Form Actions, and provides the `pending` property.
```jsx filename="app/form.js"
'use client'

import { experimental_useFormStatus as useFormStatus } from 'react-dom'

function Submit() {
Expand Down

0 comments on commit 9a08206

Please sign in to comment.