From 52dfde16d5f021824f75b783f039c450378f102d Mon Sep 17 00:00:00 2001 From: Fredrick Mgbeoma Date: Tue, 10 Oct 2017 12:10:18 +0100 Subject: [PATCH] Fix missing closing braces in code samples Fixed the closing braces for the code samples at https://reactjs.org/docs/lifting-state-up.html#lifting-state-up --- content/docs/lifting-state-up.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/docs/lifting-state-up.md b/content/docs/lifting-state-up.md index e7beb98eab2..934d42f1a4a 100644 --- a/content/docs/lifting-state-up.md +++ b/content/docs/lifting-state-up.md @@ -166,6 +166,8 @@ 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 +184,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 +197,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: