Value attribute


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

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

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.


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