Fix strict equality check in contact form input handler

Updated the input change handler to use strict equality for comparing the previous and current length of the form value, ensuring more reliable condition checks and better handling of form state updates.
This commit is contained in:
2024-08-04 23:21:05 +02:00
parent 7ab9e25eb5
commit 90cc0edcf4
+1 -1
View File
@@ -120,7 +120,7 @@ const ContactForm = () => {
as={(steps[currentStep].type === "textarea") ? "textarea" : "input"}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
handleChange(e);
if (prevLength != values[steps[currentStep].name].length) {
if (prevLength !== values[steps[currentStep].name].length) {
setFieldTouched(steps[currentStep].name);
setPrevLength(values[steps[currentStep].name].length);
}