1.3.1
🔥 Automatic mapping of initialTouched
according to initialValues
Formup will now automatically map initialTouched
object according to what you pass to initialValues
.
These are the possible outcomes:
- If you pass
initialValues
touseFormup
'soptions
, formup will mapinitialTouched
according to the fields that were passed.
Example:
useFormup(schema, {
initialValues: {
id: 100,
personalInformation: {
name: "Foo",
surname: "Bar",
},
},
});
// Formup will map initialTouched to:
{
id: true,
personalInformation: {
name: true,
surname: true,
},
}
- If you pass
initialTouched
touseFormup
'soptions
, formup will not map anything and will use the value you provided instead.
Example:
useFormup(schema, {
initialValues: {
id: 100,
personalInformation: {
name: "Foo",
surname: "Bar",
},
},
initialTouched: {
id: true,
},
});
// Formup will map initialTouched to:
{
id: true,
}