title: Formik - How do I control the value of another input field automatically when one field changes?
body: <p>I'm using Formik's <code>useFormik</code> hook to manage my forms in ReactJS. But I don't know how to build a custom onChange handler that works on top of or alongside Formik's <code>handleChange</code> function. I tried building a custom change handler like below but I'm unable to figure out what step to take next.</p>
  <pre><code>import React from &quot;react&quot;;
  import { useFormik } from &quot;formik&quot;;
  
  function testForm() {
  
    const { handleChange, values } = useFormik({
      initialValues: { title: ``, slug: `` },
      onSubmit: ( values ) =&gt; console.log( values  )
    })
    
    const customHandleChange = e =&gt; {
  
      // let's suppose title field changed.
      const { value } = e.target;
  
      // I can do other functions here, like fetching data from API
      store.dispatch( getUserByTitle( value ))
  
      // But I'm trying to set a custom value for the slug field automatically depending on changing title field value
      let slugValue = value.toLowerCase()
      
      // handleChange function changes the value of title input. How do I also change slug input?
      handleChange(e)
    }
  
    return (
  
      &lt;div&gt;
  
        &lt;input type=&quot;text&quot;
               name=&quot;Title&quot;
               value={ values.title }
               onChange={ customHandleChange }/&gt;
  
        &lt;input type=&quot;text&quot;
               name=&quot;slug&quot;
               value={ values.slug }
               onChange={ handleChange } /&gt;
      &lt;/div&gt;
  
    )
  
  }
  </code></pre>
  <p>I tried setting value of the slug input directly as follows.</p>
  <pre><code> &lt;input type=&quot;text&quot;
          name=&quot;slug&quot;
          value={ values.title.toLowerCase() }
          onChange={ handleChange } /&gt;
  </code></pre>
  <p>But if I do that, I won't be able to type in the field and make a change as the value is strictly set from the title input. Users should also be able to change the slug field value to whatever they want.</p>