DOM props and forms

value prop for form controls

For controlled text inputs and selects, value comes from application state. Update that state in the change handler to accept edits. For a checkbox, checked controls selection instead; value has a different role in submitted data.

Formal Syntax & Structure

react syntaxreact
value={text}

Working Example

Example Snippetreact
import { useState } from 'react';export default function App() { const [text,setText] = useState('Saw'); return <label>Tool<input value={text} onChange={e => setText(e.currentTarget.value)}/></label>; }
React Reference