A form has multiple inputs, so instead of having a setState function for every input, there is only one, which handles all the events. I tried to use async/await, but I couldn't manage to make it work.
const [values, setValues] = useState({
username: undefined,
password: undefined,
confirmPassword: undefined,
});
//this should be synchronous
const onChange = (e) => {
setValues({...values, [e.target.name]: e.target.value});
}