Skip to content

Commit d071a66

Browse files
Aswin TonyAswin Tony
authored andcommitted
Aswin: Improved UX by clearing field-specific error messages on input change
1 parent 01002f3 commit d071a66

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/components/SocialArchitecture/RequestResources.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ function RequestResources() {
2020

2121
const handleChange = e => {
2222
const { name, value } = e.target;
23+
24+
// Update form data
2325
setFormData({ ...formData, [name]: value });
26+
27+
// Clear error for this specific field when user types or selects a valid value
28+
if (errors[name]) {
29+
setErrors(prevErrors => {
30+
const updatedErrors = { ...prevErrors };
31+
delete updatedErrors[name];
32+
return updatedErrors;
33+
});
34+
}
2435
};
2536

2637
const handleFileChange = e => {

0 commit comments

Comments
 (0)