title: Is there a way to require a field based on another field using a Yup schema?
body: <p>I have a title (input field) and a checkbox. I've successfully implemented a schema to require the checkbox on its own. What I want to do is, validate if something has been typed in the title, if it's empty then the checkbox is required. I tried following Yup docs but I can't get anything to work.</p>
  <p>I've tried this, but I don't get an error when the title isn't filled.</p>
  <pre><code>const validationSchema = Yup.object({
  title: Yup.string()
  .required('Required'),
  checkbox: Yup.bool()
  .when('title', ({ is: true, then: Yup.bool().required('Required') }))
  });
  </code></pre>
  <p>And if possible, is there a way to validate a field using a state in my component instead?</p>