In React I am trying to make a button increment a value stored in state. However using the code below function my value is set undefined or NaN when using handleClick.
This is the shortest code for that. First, initialize the state, then perform a method to increment.
state = { counter: 0 }
increaseHandler = () => { let counter = this.state.counter counter += 1 this.setState({counter: counter}) }