Add return to render
lucas committed
Dec 1, 2016 at 19:17 UTC
01eb94f04ba44f0146995e529d6b47c318970948
1 file changed
+14
-10
docs/docs/optimizing-performance.md
+14
-10
@@ -79,11 +79,13 @@ class CounterButton extends React.Component {
79
}
80
81
render() {
82
- <button
83
- color={this.props.color}
84
- onClick={() => this.setState(state => ({count: state.count + 1}))}>
85
- Count: {this.state.count}
86
- </button>
82
+ return (
83
+ <button
84
+ color={this.props.color}
85
+ onClick={() => this.setState(state => ({count: state.count + 1}))}>
86
+ Count: {this.state.count}
87
+ </button>
88
+ );
89
}
90
}
91
```
@@ -98,11 +100,13 @@ class CounterButton extends React.PureComponent {
100
}
101
102
render() {
101
- <button
102
- color={this.props.color}
103
- onClick={() => this.setState(state => ({count: state.count + 1}))}>
104
- Count: {this.state.count}
105
- </button>
103
+ return (
104
+ <button
105
+ color={this.props.color}
106
+ onClick={() => this.setState(state => ({count: state.count + 1}))}>
107
+ Count: {this.state.count}
108
+ </button>
109
+ );
110
}
111
}
112
```