Why does the conditional statement inside handleDecrement
if(counter>1)
not work?
const [counter, setCounter] = React.useState(1);
function handleIncrement (counter){
setCounter(counter => counter + 1)
}
function handleDecrement (counter){
if(counter>1){
setCounter(counter => counter - 1)
}
}
question from:https://stackoverflow.com/questions/65843995/cant-understand-why-i-cant-access-the-value-of-counter