If I call a useCallback method to update a redux store value that is in its dependency array, will I get the updated value immediately or on the next call of the method?
For example, if the value
in this example is 5
when I call the method, will I log 5 or 10?
const doSomething = React.useCallback(async () => {
await dispatch(changeValue(10));
console.log(value);
}, [value]);
I think that there is a chance it could be if the update is fast enough, but I would like to know what is the expected behavior.