React: Write a Simple Counter: not decrementing

React: Write a Simple Counter: not decrementing
0

#1

I can’t seem to find why my decrement isn’t working. Thanks for any help

class Counter extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      count: 0
    };
    // change code below this line
    this.increment = this.increment.bind(this)
    this.decrement - this.decrement.bind(this)
    this.reset = this.reset.bind(this)
    // change code above this line
  }
  // change code below this line
  increment(){
    this.setState({
      count: this.state.count + 1
    });
  }
  decrement(){
    this.setState({
      count: this.state.count - 1
    });
  }
  reset(){
    this.setState({
      count: 0
    });
  }
  // change code above this line
  render() {
    return (
      <div>
        <button className='inc' onClick={this.increment}>Increment!</button>
        <button className='dec' onClick={this.decrement}>Decrement!</button>
        <button className='reset' onClick={this.reset}>Reset</button>
        <h1>Current Count: {this.state.count}</h1>
      </div>
    );
  }
};

#2

You have a typo this line. Can you figure it out?


#3

Thanks I got it…dumb mistake lol


#4

Typo on line 9 you wrote - it should be =