react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

[Typo]: Inconsistency in the <form> element docs

Open denexapp opened this issue 1 year ago • 1 comments
trafficstars

Summary

The "Display a form submission error without JavaScript" section on the form element docs page states the following, among other things:

Displaying a [...] error message [...] requires that:
- <form> be rendered by a Server Component
- [...]
- the useFormState Hook be used to display the error message

Then there's an example on how to do this. However, there are two concerns with the example:

  • The provided example uses a client component, not a server component, so the <form> element is being rendered in a client component, breaking the first requirement
  • If we pretend that the client component is used instead of a server component for the demonstration purposes only, the component that renders the <form> element uses the useFormState hook, which is not allowed for server components.

Page

https://react.dev/reference/react-dom/components/form#display-a-form-submission-error-without-javascript

Details

No response

denexapp avatar Feb 02 '24 10:02 denexapp

Yeah this example is borked and we need to fix it, cc @mattcarrollcode

rickhanlonii avatar Feb 11 '24 20:02 rickhanlonii