I might be having one of those days but I am updating state in boolean and numbers, but when I click on the values the old value appears first, and no the value of the button does not depend on the old value, do you still have to use prev value even for boolean, if so how and why?
https://stackblitz.com/edit/react-xj8gka?file=src%2FApp.js
Minimal example in the stackblitz too:
import React, {useState} from "react";
import "./style.css";
export default function App() {
const [value, setValue] = useState(1)
const [boolean, setBoolean] = useState(false)
return (
<div>
<button onClick={() => {setValue(() => 1)
console.log(value)
}}>Value 1</button>
<button onClick={() => {setValue(() => 2)
console.log(value)
}}>Value 2</button>
<p>Booleans</p>
<button onClick={() => {setBoolean(() => true)
console.log(boolean)
}}>True</button>
<button onClick={() => {setBoolean(() => false)
console.log(boolean)
}}>False</button>
</div>
);
}