You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I am typing my inputs like this
type Input = {
fieldName: string;
label: string;
isRequired: boolean;
};
...
const {
register,
handleSubmit,
watch,
formState: { errors },
} = useForm<Input[]>();
...
This actually works, BUT I get a TS complaint in ...register(input.fieldName... because it thinks the inputs are named "fieldName", "label", and "isRequired" rather than them being properties of ONE input, and the "name" being the input.fieldName value.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Say I am typing my inputs like this
type Input = {
fieldName: string;
label: string;
isRequired: boolean;
};
...
const {
register,
handleSubmit,
watch,
formState: { errors },
} = useForm<Input[]>();
...
{inputs.map((input) => (
This actually works, BUT I get a TS complaint in ...register(input.fieldName... because it thinks the inputs are named "fieldName", "label", and "isRequired" rather than them being properties of ONE input, and the "name" being the input.fieldName value.
Beta Was this translation helpful? Give feedback.
All reactions