name: Yup.string()
.required(),
});
const {
errors,
touched,
getFieldProps,
handleChange,
} = formik;
function onChange(e) {
if (Object.keys(errors).length === 0) {
**(HERE I HAVE errors.length 0, despite this my input is empty and is required, so I shuld have errors here. I have error here, but with delay, )**
dispatch(setInvitationConfigParam({ name: e.target.name, value: e.target.value }));
}
handleChange(e);
}
<InputWrapper>
<TextInput
customClass="input"
error={false}
textFieldProps={{
label: t('configurationForm.settings.nameConfiguration'),
error: hasErrors('name', errors, touched),
helperText: getErrors('name', errors, touched),
...getFieldProps('name'),
onChange,
}}
tooltipTitle={t('configurationForm.settings.nameConfigurationDescription')}
/>
What I want and why I have problem.
I want to sending dispach function every time when user change his input name, but if the input name is empty I didn't want sendig dispatch.
The problem is that: object errors show errors with a delay.
how can I have errors with no dealy?