I have the following states
const [humans, setHumans] = useState([]);
const [animales, setAnimals] = useState([]);
And the following function
const f = () => {
console.log(humans);
console.log(animals);
}
which only has to be executed when the following useEffect finishes updating both states
useEffect(() => {
setHumans([ ... ]);
setAnimals([ ... ]);
f();
}, []);
How can I make sure that f is executed after both asynchronous state updates has finished?