one liner

This commit is contained in:
Jared Forsyth 2013-12-17 17:12:21 -07:00
parent bf6951687d
commit e539c8c6c4
1 changed files with 2 additions and 4 deletions

View File

@ -68,14 +68,12 @@ However, it's **not** an anti-pattern if you intentionally make it clear that sy
var Counter = React.createClass({
getInitialState: function() {
// naming it initialX clearly indicates that the only purpose
// naming it initialX clearly indicates that the only purpose
// of the passed down prop is to initialize something internal
return {count: this.props.initialCount};
},
handleClick: function() {
this.setState({
count: this.state.count + 1
});
this.setState({count: this.state.count + 1});
},
render: function() {
return <div onClick={this.handleClick}>{this.state.count}</div>;