Guest User

Untitled

a guest
Oct 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import React from 'react';
  2. class MyComponent extends React.Component {
  3.  
  4. state = {
  5. data: 0
  6. }
  7.  
  8. handleClick() {
  9. const data = this.state.data;
  10. this.setState({
  11. data: data + 1
  12. });
  13. }
  14.  
  15. render() {
  16. return (
  17. <button onClick={ this.handleClick }>Click me!</button>
  18. );
  19. }
  20. }
Add Comment
Please, Sign In to add comment