Two Condition in When in Yup in React

Viewed 4607

I wanted to put two conditions that if its isProduct or isBox is true, then product_id should be required. I did this code below and it isnt working

 product_id: yup.string().when(['isProduct', 'isBox'], {
    is: true,
    then: yup.string().required('Select product'),
  }),
1 Answers
Related