I have this form
const form = useForm({
context: { existingNames },
mode: 'onChange',
reValidateMode: 'onChange',
resolver: yupResolver(validationRules),
delayError: 600,
});
And want to use the existingNames context, an array of names, inside the oneOf rule.
const validationRules = Yup.object({
name: Yup.oneOf(existingNames, , 'Name already in use.'), // ๐ ?
})
How?