Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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>
- );
- }
- }
Add Comment
Please, Sign In to add comment