共计 363 个字符,预计需要花费 1 分钟才能阅读完成。
validationSchema change depending on form values
<Formik
initialValues={{planType: 'PRE'}}
validationSchema={() => yup.lazy((values) => {
const isCPF = values.docType === 'cpf'
return yup.object().shape({docType: yup.string(),
number: isCPF ? yup.string().cpf() : yup.string().cnpj()
})
})}
onSubmit={loadPlanActivation}
render={this.renderForm}
/>
validationSchema change depending on form values #1228
正文完