useEffect(() => {
getAllCompanies()
.then((response) => {
//setting
})
.then(
setSearch(value)
)
.then(
doSomethingWith(value)
)
}, []);
I have an useEffect where I get Info and then with setSearch() I am setting some info to state but when I call doSomethingWith(value) it is using previous state and doesn't work asynchroniosly. What can I do?
If you have some questions please comment