Skip to content

Instantly share code, notes, and snippets.

@ruffle1986
Created October 18, 2017 15:55
Show Gist options
  • Save ruffle1986/d7c8d64c5ea977ff412ec89fef2fc099 to your computer and use it in GitHub Desktop.
Save ruffle1986/d7c8d64c5ea977ff412ec89fef2fc099 to your computer and use it in GitHub Desktop.
import React from 'react';
class MyComponent extends React.Component {
state = {
data: 0
}
handleClick() {
const data = this.state.data;
this.setState({
data: data + 1
});
}
render() {
return (
<button onClick={ this.handleClick }>Click me!</button>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment