I'm learning how to use <form>
's in React and most examples I've seen use a combination of state
and onChange
to keep track of your form's inputs:
class Form extends React.Component {
handleChange(event) {
this.setState({
inputvalue: event.target.value
})
}
render() {
return (
<form onSubmit={this.handleSubmit.bind(this)}>
<label>Name</label>
<input type="text" value={this.state.inputvalue} onChange={this.handleChange.bind(this)}/>
<input type="submit" value="Submit"/>
</form>
);
}
}
However, say I have numerous <input>
's and even some <textarea>
's which might change quite often. In that case each one of them would call the onChange
method each time they are updated and the component would re-render on every key press.
Seeing as how people can type pretty fast, could this be an area for concern?