title: How to validate form using Yup and Formik
body: <p>I need to validate checkboxes if they are in the DOM.</p>
  
  <p>This is my validation schema. So depending whether some state is true or false I am showing either confirm1 or confirm2 checkbox. Currently fields are not showing errors and I can not submit the form.</p>
  
  <pre><code> const validationSchema = yup.object().shape({
      confirm1: yup.boolean().notRequired()
      .when('confirm2', {
        is: (val) =&gt; val === true,
        then: yup.boolean().required('Field must be checked'),
        otherwise: yup.boolean().notRequired()
      }),
      confirm2: yup.boolean().notRequired()
      .when('confirm1', {
        is: (val) =&gt; val === true,
        then: yup.boolean().required('Field must be checked'),
        otherwise: yup.boolean().notRequired()
      })
    }, ['confirm1', 'confirm2'])
  </code></pre>