mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #8478 from lucas-aragno/add-return-to-render
Add return to render
This commit is contained in:
commit
1cabbc2fd7
1 file changed
+14
-10
@@ -79,11 +79,13 @@ class CounterButton extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
<button
|
||||
color={this.props.color}
|
||||
onClick={() => this.setState(state => ({count: state.count + 1}))}>
|
||||
Count: {this.state.count}
|
||||
</button>
|
||||
return (
|
||||
<button
|
||||
color={this.props.color}
|
||||
onClick={() => this.setState(state => ({count: state.count + 1}))}>
|
||||
Count: {this.state.count}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -98,11 +100,13 @@ class CounterButton extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
<button
|
||||
color={this.props.color}
|
||||
onClick={() => this.setState(state => ({count: state.count + 1}))}>
|
||||
Count: {this.state.count}
|
||||
</button>
|
||||
return (
|
||||
<button
|
||||
color={this.props.color}
|
||||
onClick={() => this.setState(state => ({count: state.count + 1}))}>
|
||||
Count: {this.state.count}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user