Going through React, I was wondering why the method handlechange wasn't coded as the following. As I've tried both seem to work. Wondering if this is a destructuring assignement.
handleCelsiusChange(temperature) {
this.setState({scale: 'c', temperature: temperature});
}
original code:
constructor(props) {
super(props);
this.handleCelsiusChange = this.handleCelsiusChange.bind(this);
this.handleFahrenheitChange = this.handleFahrenheitChange.bind(this);
this.state = {temperature: '', scale: 'c'};
}
handleCelsiusChange(temperature) {
this.setState({scale: 'c', temperature});
}
handleFahrenheitChange(temperature) {
this.setState({scale: 'f', temperature});
}
Code takend from reactJs