Added ellipsis to indicate incomplete code snippet (#115)
* Added ellipsis to indicate incomplete code snippet
Ellipsis indicate that the code snippet shown is part of a larger code sample.
* Add missing indentation
@ -166,6 +166,7 @@ class TemperatureInput extends React.Component {
render() {
render() {
const temperature = this.state.temperature;
const temperature = this.state.temperature;
// ...
```
```
However, we want these two inputs to be in sync with each other. When we update the Celsius input, the Fahrenheit input should reflect the converted temperature, and vice versa.
However, we want these two inputs to be in sync with each other. When we update the Celsius input, the Fahrenheit input should reflect the converted temperature, and vice versa.
@ -182,6 +183,7 @@ First, we will replace `this.state.temperature` with `this.props.temperature` in
render() {
render() {
// Before: const temperature = this.state.temperature;
// Before: const temperature = this.state.temperature;
const temperature = this.props.temperature;
const temperature = this.props.temperature;
// ...
```
```
We know that [props are read-only](/docs/components-and-props.html#props-are-read-only). When the `temperature` was in the local state, the `TemperatureInput` could just call `this.setState()` to change it. However, now that the `temperature` is coming from the parent as a prop, the `TemperatureInput` has no control over it.
We know that [props are read-only](/docs/components-and-props.html#props-are-read-only). When the `temperature` was in the local state, the `TemperatureInput` could just call `this.setState()` to change it. However, now that the `temperature` is coming from the parent as a prop, the `TemperatureInput` has no control over it.
@ -194,6 +196,7 @@ Now, when the `TemperatureInput` wants to update its temperature, it calls `this