For some reason, a state is not being set until clicking on the submit button twice when submitting my form. Here is my state:
const [state, setState] = useSt