Skip to content

Commit a201113

Browse files
fuchodevelopergaearon
authored andcommitted
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
1 parent 16b5b8f commit a201113

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

content/docs/lifting-state-up.md

+3
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ class TemperatureInput extends React.Component {
166166
167167
render() {
168168
const temperature = this.state.temperature;
169+
// ...
169170
```
170171

171172
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
182183
render() {
183184
// Before: const temperature = this.state.temperature;
184185
const temperature = this.props.temperature;
186+
// ...
185187
```
186188

187189
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
194196
handleChange(e) {
195197
// Before: this.setState({temperature: e.target.value});
196198
this.props.onTemperatureChange(e.target.value);
199+
// ...
197200
```
198201

199202
>Note:

0 commit comments

Comments
 (0)