export const validationSchema = (): FormValidationSchema => {
const validationObject: { [key: string]: StringSchema } = {}
// validation schema keys based on the name prop of the radio buttons in the form
HOBBIES.forEach((hobby) => {
validationObject[hobby.stateName] = Yup.string().required()
})
return Yup.object(validationObject)
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter