title: Using Yup to validate radiobox or checkbox value
body: <p>I am using two library with is Formik and Yup. And trying to validate by the value stored on the radio box(check box as well) but seems like I cant find anything on google where I can get the actual value to check. I can use the name value to validate but is there a way to check validation by looking at the value? I will provide the example below.</p>
  <pre><code>  const initialValues = {
    A: &quot;&quot;,
    B: &quot;&quot;,
    C: [],
  };
  
  const onSubmit = (values) =&gt; {
    console.log(values);
  };
  
  const validationSchema = Yup.object({
    A: Yup.string().required(&quot;Required&quot;),
    B: Yup.string().required(&quot;Required&quot;),
    C: Yup.array().min(1, &quot;Must be selected&quot;),
  });
  </code></pre>
  <p>and here is the return for react</p>
  <pre><code>return (
      &lt;&gt;
        &lt;Formik
          enableReinitialize={true}
          initialValues={initialValues}
          validationSchema={validationSchema}
          onSubmit={onSubmit}
          render={(props) =&gt; &lt;TreatmentView {...props} data={data} /&gt;}
        /&gt;
      &lt;/&gt;
    );
  </code></pre>
  <p>And this is the rendered view below</p>
  <p><a href="https://i.stack.imgur.com/pa0PZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pa0PZ.png" alt="enter image description here" /></a></p>
  <p>I want to store that logic on the validationSchema. So again, I want to add a validation where checkbox with name &quot;C&quot; with value &quot;4&quot; can only be checked when radio button of name &quot;B&quot; with value &quot;3&quot; is selected. I did looked at the doc for the YUP and tried using the .value but seems like its not working..</p>
  <p>Thank You!</p>