is it possible to use async to wait for a function to complete inside a onChange event. Example:
const onChange = async (e) => {
console.log(current[e.target.name]);
await setCurrent({ ...current, [e.target.name]: e.target.value });
console.log(current[e.target.name]);
}
the second console.log is giving the same value since it is not waiting for the setCurrent to finish. Is there a way to make it wait for that?
Thank you