SHARE
TWEET

Untitled

a guest Feb 26th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top