Browse Source

Add return to render

main
lucas 8 years ago
parent
commit
ab12949031
  1. 24
      docs/optimizing-performance.md

24
docs/optimizing-performance.md

@ -79,11 +79,13 @@ class CounterButton extends React.Component {
} }
render() { render() {
<button return (
color={this.props.color} <button
onClick={() => this.setState(state => ({count: state.count + 1}))}> color={this.props.color}
Count: {this.state.count} onClick={() => this.setState(state => ({count: state.count + 1}))}>
</button> Count: {this.state.count}
</button>
);
} }
} }
``` ```
@ -98,11 +100,13 @@ class CounterButton extends React.PureComponent {
} }
render() { render() {
<button return (
color={this.props.color} <button
onClick={() => this.setState(state => ({count: state.count + 1}))}> color={this.props.color}
Count: {this.state.count} onClick={() => this.setState(state => ({count: state.count + 1}))}>
</button> Count: {this.state.count}
</button>
);
} }
} }
``` ```

Loading…
Cancel
Save