Value attribute

What is the need of the attribute value in the input?

<input type="text" onChange={this.handleUserInput} value={this.state.userInput}/>
 <h1>{this.state.userInput}</h1>

Only the bind in the h1 already solve the problem, i guess…

See the section on “Controlled Components”:

Got it, thanks. The state of the input element must be updated too.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.