Skip to content

Instantly share code, notes, and snippets.

@beatlecz
Created April 30, 2019 11:55
Show Gist options
  • Save beatlecz/d212625d457d5103f32252d3edffb3cb to your computer and use it in GitHub Desktop.
Save beatlecz/d212625d457d5103f32252d3edffb3cb to your computer and use it in GitHub Desktop.
const valSchema = Yup.lazy(values => {
let validation = {
// put your non dynamic validation here
}
if (values.somethig) validation = {
...validation,
somethingBaseVal: Yup.object().shape({
// put dynamic validation
})
}
return validation
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment