Closed shangsunset closed 9 years ago
Hi,
i tried to set state on form change, but it didnt work as expected. i couldnt type in the input box when i had a onChange() function. where am i dong wrong? thanks!
onChange()
getInitialState: function() { return: { userInput: {} } }, onChange: function(value) { this.setState({userInput: value}, function() { console.log(this.state.userInput) }) }, render () { return: { <div className="col-md-8"> <Form ref="form" type={Page} options={options} onChange={this.onChange} /> <button className="btn btn-primary" onClick={this.save}>Save</button> </div> ) }
<Form ref="form" type={Page} options={options} value={this.state.userInput} // <= this is missing onChange={this.onChange} />
Thanks a lot!
Hi,
i tried to set state on form change, but it didnt work as expected. i couldnt type in the input box when i had a
onChange()
function. where am i dong wrong? thanks!