Skip to content

Instantly share code, notes, and snippets.

@fand
Last active December 20, 2016 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/dd554cd5b6e9d34bafc7a911278ce979 to your computer and use it in GitHub Desktop.
Save fand/dd554cd5b6e9d34bafc7a911278ce979 to your computer and use it in GitHub Desktop.
セミコロン付けるとダサい.js
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