From 4de50aed2cf0b004754436126468d0422b3ca09a Mon Sep 17 00:00:00 2001 From: Fredrick Mgbeoma Date: Tue, 10 Oct 2017 12:41:41 +0100 Subject: [PATCH 1/2] Added ellipsis to indicate incomplete code snippet Ellipsis indicate that the code snippet shown is part of a larger code sample. --- content/docs/lifting-state-up.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/docs/lifting-state-up.md b/content/docs/lifting-state-up.md index e7beb98eab2..58242e3b12c 100644 --- a/content/docs/lifting-state-up.md +++ b/content/docs/lifting-state-up.md @@ -166,6 +166,7 @@ class TemperatureInput extends React.Component { render() { 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. @@ -182,6 +183,7 @@ First, we will replace `this.state.temperature` with `this.props.temperature` in render() { // Before: const temperature = this.state.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. @@ -194,6 +196,7 @@ Now, when the `TemperatureInput` wants to update its temperature, it calls `this handleChange(e) { // Before: this.setState({temperature: e.target.value}); this.props.onTemperatureChange(e.target.value); + // ... ``` >Note: From 5cd713dd6f8362f207a69f20296a091378ae8355 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 10 Oct 2017 12:51:29 +0100 Subject: [PATCH 2/2] Add missing indentation --- content/docs/lifting-state-up.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/lifting-state-up.md b/content/docs/lifting-state-up.md index 58242e3b12c..43cb7db8d22 100644 --- a/content/docs/lifting-state-up.md +++ b/content/docs/lifting-state-up.md @@ -166,7 +166,7 @@ class TemperatureInput extends React.Component { render() { 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.