Skip to content

Commit 5a06609

Browse files
committed
fixing onSubmit link and code example clean up
1 parent 8bce77f commit 5a06609

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • src/content/reference/react-dom/components

‎src/content/reference/react-dom/components/form.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To create interactive controls for submitting information, render the [built-in
4343
* The function may be async. React calls it with a single argument containing the [form data](https://developer.mozilla.org/en-US/docs/Web/API/FormData) of the submitted form.
4444
* A `formAction` prop on a `<button>`, `<input type="submit">`, or `<input type="image">` overrides this `action`.
4545
* [`method`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form#method): A string that specifies the HTTP method to use when `action` is a URL. Defaults to `get`.
46-
* `onSubmit`: An [`Event` handler](/reference/react-dom/components/common#event-handler) function. Fires when the form is submitted. See [Handling form submission with an event handler](#handle-form-submission-with-an-event-handler).
46+
* `onSubmit`: An [`Event` handler](/reference/react-dom/components/common#react-event-object) function. Fires when the form is submitted. See [Handling form submission with an event handler](#handle-form-submission-with-an-event-handler).
4747

4848
#### Caveats {/*caveats*/}
4949

@@ -313,7 +313,7 @@ import { useOptimistic, useState, useRef } from 'react';
313313
import { deliverMessage } from './actions.js';
314314

315315
function Thread({ messages, sendMessage }) {
316-
const formRef = useRef();
316+
const formRef = useRef(null);
317317
async function formAction(formData) {
318318
addOptimisticMessage(formData.get('message'));
319319
formRef.current.reset();
@@ -400,9 +400,9 @@ export default function Search() {
400400
```json package.json hidden
401401
{
402402
"dependencies": {
403-
"react": "19.0.0-rc-3edc000d-20240926",
404-
"react-dom": "19.0.0-rc-3edc000d-20240926",
405-
"react-scripts": "^5.0.0",
403+
"react": "latest",
404+
"react-dom": "latest",
405+
"react-scripts": "latest",
406406
"react-error-boundary": "4.0.3"
407407
},
408408
"main": "/index.js"

0 commit comments

Comments
 (0)