DOM props and forms
name prop for form fields
Names a form control for submission. FormData uses this key for successful controls; a field without a name is not included. An id labels or identifies a DOM element and does not replace name.
Formal Syntax & Structure
react syntaxreact
name="tool"Working Example
Example Snippetreact
export default function App() { return <form onSubmit={e=>{e.preventDefault();console.log(new FormData(e.currentTarget).get('tool'));}}><label>Tool<input name='tool' defaultValue='Saw'/></label><button>Read value</button></form>; }