Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import React, {Component} from 'react'
  2. import './Display.css'
  3. import Button from './Button'
  4.  
  5. const initialState = {
  6. showDisplay: 0,
  7. }
  8. export default class Display extends Component{
  9. state = {...initialState}
  10.  
  11. acrescentar(){
  12. const value = this.state.showDisplay
  13. const valuef = value + 1
  14. this.setState({showDisplay: valuef})
  15. }
  16.  
  17. decrescentar(){
  18. this.setState({showDisplay: 1})
  19. }
  20. render(){
  21. return(
  22. <div className="Display">
  23. <h1>{this.state.showDisplay}</h1>
  24. <Button acre={this.acrescentar} decre={this.decrescentar}/>
  25. </div>
  26. )
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement