I have a modal that contains a form. Whenever I submit data through it and console log it, it never works the first time. The second time I submit data through it, the console log of the previous entry. Can anyone identify if I am potentially missing anything?
const handleSubmit = (event) => {
event.preventDefault();
setOpen(false);
setSubmission({
ref: event.target[0].value,
brand: event.target[1].value,
iname: event.target[2].value,
gtin: event.target[3].value,
qty: 0,
});
console.log(submission);
};