This is my code:
const [tab, setTab] = useState("a")
const setTabCustom = (value: string) => {
console.log(value)
setTab(value)
anotherFunc();
}
const anotherFunc = () => {
console.log(tab)
}
<span onClick={() => setTabCustom("b")}>Click</span>
And this is result:
b
a
Why?
I use setTab and after anotherFunc most show this result:
b
b
Live code: https://playcode.io/900225