title: How do I access current value of a formik field without submitting?
body: <p>How do I access value of the <code>SelectField</code> named <code>countryCode</code> in my React component? Use case is that validation scheme should change according to the countryCode.</p>
  
  <pre><code>  &lt;Formik
      onSubmit={(values, actions) =&gt; this.onSubmit(values, actions.setFieldError)}
      validationSchema={() =&gt; this.registrationValidationSchema()}
      enableReinitialize={true}
      initialValues={this.props.initialData}
    &gt;
        &lt;Form&gt;
            &lt;Field
              name="countryCode"                                
              component={SelectField}
              label="Country"
              labelClassName="required"
              options={Object.entries(sortedCountryList).map(x =&gt; ({
                        value: x[1][1],
                        label: x[1][0]
                      }))}
            /&gt;
        &lt;/Form&gt;
    &lt;/Formik&gt;
  </code></pre>
  
  <p>I have tried to access it via a ref, then via <code>this.props.values</code> (as suggested in <a href="https://stackoverflow.com/questions/50456236/getfieldvalue-or-similar-in-formik">getFieldValue or similar in Formik</a>) but both return just undefined or null. My props don't have any "values" field.</p>
  
  <p>EDIT: Found an ugly way: <code>document.getElementsByName("countryCode")[0].value</code>. A better way is appreciated.</p>