When I press the "." to add the decimal, the display goes from "0" to "undefined.". That is, add it but the 0 becomes undefined. I do not understand why.
state = {
displayValue:"0",
operator: null,
pendingOperation: false,
newValue: null
};
inputDot(){
const displayValue=this.displayValue;
this.setState({
displayValue: displayValue + "."
})
console.log(this.displayValue)
}
<button type="button"onClick={() => this.inputDot()}>.</button>