import React, { Component } from 'react';
import './css/app.css';

class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      count: 0,
    }
  }
  render() {
    return (
      <div>
        <button onClick={this.decreaseCount}>-</button>
        {this.state.count}
        <button onClick={this.increaseCount}>+</button>
      </div>
    );
  }
  //custom methods
  decreaseCount = ()=>{
    this.setState((prevState,props)=>({count: --prevState.count}))
  }
  increaseCount = ()=>{
    this.setState((prevState,props)=>({count: ++prevState.count}))
  }
}

export default App;
