when I just use <input {...register(name)} />, validation works correctly: empty required-fields give an error, when filled out, the error disappears. But if this input is moved to a separate component, does the error disappear when filled in?
Code:
parent:
<InputField
validationType="underlineText"
invalidText={errors?.[name]?.message}
invalid={Boolean(errors?.[name]?.message)}
{...register(name)}
/>
InputField.tsx:
export const InputField = memo(({
invalid,
invalidText,
validationType,
...otherProps
}: IInputProps) => (
<InputValidationWrapper
invalid={invalid}
invalidText={invalidText}
validationType={validationType}
>
<input
{...otherProps}
/>
</InputValidationWrapper>
))