Skip to content

Commit

Permalink
docs: clarify data type in Forms and Mutations section (#54630)
Browse files Browse the repository at this point in the history
### What?

Clarify the "Forms and Mutations" docs. 

### Why?

This may be opinionated, but I believe this section of the docs starts out assuming that the user knows how the `<form>` HTML works. Coming from the client side React world, most developers are used to using state in forms. Clarifying that this data is accessible via the standard web API [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) is essential for both transitioning developers and new developers.
  • Loading branch information
michaelangeloio authored Aug 30, 2023
1 parent 56c9ad8 commit d02124a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ export default function Page() {
}
```

> **Good to know**: `<form action={create}>` takes the [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) data type. In the example above, the FormData submitted via the HTML [`form`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) is accessible in the server action `create`.
### Revalidating Data

Server Actions allow you to invalidate the [Next.js Cache](/docs/app/building-your-application/caching) on demand. You can invalidate an entire route segment with [`revalidatePath`](/docs/app/api-reference/functions/revalidatePath):
Expand Down

0 comments on commit d02124a

Please sign in to comment.