Skip to content

Commit 60d4dcd

Browse files
authored
fix(form): check form reference before removing "was-validated" className (#37)
1 parent ff3b94c commit 60d4dcd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/forms/Form.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export function Form({
2222
const [isSubmiting, setIsSubmiting] = useState(false);
2323

2424
function resetForm() {
25-
formRef.current.classList.remove('was-validated');
25+
if (formRef.current && formRef.current.classList) {
26+
formRef.current.classList.remove('was-validated');
27+
}
28+
2629
formState.reset();
2730
}
2831

0 commit comments

Comments
 (0)