Last active
December 20, 2016 13:04
-
-
Save fand/dd554cd5b6e9d34bafc7a911278ce979 to your computer and use it in GitHub Desktop.
セミコロン付けるとダサい.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class Foo extends React.Component { | |
constructor () { | |
super(); | |
this.state = { count : 0 }; | |
} | |
increment = () => this.setState({ count : this.state.count + 1 }) // ;付けるとダサい気がする | |
decrement = () => { | |
this.setState({ count : this.state.count - 1 }) | |
} // ;付けるとダサい気がする | |
render () { | |
return ( | |
<div> | |
<div>Count : {this.state.count}</div> | |
<button onClick={this.increment}>+</button> | |
<button onClick={this.decrement}>-</button> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment