Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import logo from './logo.svg';
  3. import './App.css';
  4.  
  5. class App extends Component {
  6. constructor(props) {
  7. super(props);
  8.  
  9. this.state = {
  10. counter:0
  11. };
  12. }
  13. render() {
  14. return (
  15. <div data-test="component-app">
  16. <h1 data-test="counter-display">The counter is currently {this.state.counter}</h1>
  17. <button
  18. data-test="increment-button"
  19. onClick={() => this.setState({ counter: this.state.counter + 1 })}
  20. >
  21. Increment counter
  22. </button>
  23. </div>
  24. );
  25. }
  26. }
  27.  
  28. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement