React DOM integration
requestFormReset
Requests an uncontrolled field reset at the completion of a React Action or Transition. Controlled inputs require an explicit state reset. Use a React-managed HTML form rather than an arbitrary node.
Formal Syntax & Structure
react syntaxreact
requestFormReset(form)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| form | HTMLFormElement | React-managed form element. |
Return Value
void
No return value.
Working Example
Example Snippetreact
import { startTransition } from 'react';import { requestFormReset } from 'react-dom';export default function App() { return <form onSubmit={event => { event.preventDefault(); const form = event.currentTarget; startTransition(() => requestFormReset(form)); }}><label>Tool <input name='tool' defaultValue='Saw' /></label><button>Reset after transition</button></form>;}