Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class Addgrocery extends React.Component{
  2. constructor(props) {
  3. super(props);
  4. this.state = {
  5. count : 0;
  6. }
  7. }
  8.  
  9. addgrcy =() => {
  10. this.setState({
  11. number: this.state.number +1
  12. });
  13. }
  14.  
  15. render(){
  16. return (
  17. <div>
  18. <h1>counter</h1>
  19. <div>{this.state.count}</div>
  20. <button onClick={this.addgrcy}>+</button>
  21. </div>
  22. );
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement