When using useState hooks in React I have a scenario in which I would like to use it like so:
const [count, setCount] = useState(0);
const [page, setPage] = useState(0);
setCount(currentCount => {
if (currentCount > 0) {
setPage(0);
return 0;
}
return currentCount + 1;
});
Is it considered bad practice to use them nested like this? If so, are there any documentation on why this would be bad practice?