i am sharpening me react skills and by doing this i stumbled across this sweet line of code.
export default class SearchBar extends Component {
constructor(props) {
super(props);
this.state({term:''});
this.onInputChange = this.onInputChange.bind(this);
}
onInputChange(event) {
this.setState({ term: event.target.value});
}
}
Here the jsx part
render() {
return(<input
value={ this.state.term }
onChange={ this.onInputChange }
/>)
}
Can you please help/tell or show me sources, where i can really understand what is going on in the line?
this.onInputChange = this.onInputChange.bind(this);
it kind of confuse me. thanks for your affords. and kind regards