Forms

Controlled input

A text field whose visible value is supplied by state and updated through a change handler.

Formal Syntax & Structure

react syntaxreact
<input value={text} onChange={e => setText(e.target.value)} />

Working Example

Example Snippetreact
const [text, setText] = useState('');
React Reference