Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, {Component} from 'react'
- import './Display.css'
- import Button from './Button'
- const initialState = {
- showDisplay: 0,
- }
- export default class Display extends Component{
- state = {...initialState}
- acrescentar(){
- const value = this.state.showDisplay
- const valuef = value + 1
- this.setState({showDisplay: valuef})
- }
- decrescentar(){
- this.setState({showDisplay: 1})
- }
- render(){
- return(
- <div className="Display">
- <h1>{this.state.showDisplay}</h1>
- <Button acre={this.acrescentar} decre={this.decrescentar}/>
- </div>
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement