Guest User

Untitled

a guest
Apr 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import React, { Component } from 'react';
  2.  
  3. class App extends Component {
  4. constructor(props) {
  5. super(props);
  6. this.state = {counter: 0};
  7. }
  8. CenterButtonClickEvent(e){
  9. this.setState((prevState, props) => ({
  10. counter: prevState.counter + 1
  11. }))
  12. }
  13. render() {
  14. return (
  15. <div>
  16. <button style={{"width" : "100%", "height": "97vh"}} onClick={this.CenterButtonClickEvent.bind(this)}>{this.state.counter}</button>
  17. </div>
  18. );
  19. }
  20. }
  21.  
  22. export default App;
Add Comment
Please, Sign In to add comment