For example, why not use value={this.props.temperature} in the example below? state has a similar usage.
Is this just to be functional, so that the underlying components cannot modify the state of the upper layer? Is it a restriction or a convention?
render() {
const temperature = this.props.temperature;
const scale = this.props.scale;
return (
<fieldset>
<legend>Enter temperature in {scaleNames[scale]}:</legend>
<input value={temperature}
onChange={this.handleChange} />
</fieldset>
);
}
It is just a syntactic sugar to use a const here instead of the long form this.props.something, It also gives you the ability to edit it in one place, instead of editing it in every place (e.g changing the name of the prop)