title: Uploading files in react by react-dropzone and formik
body: <p>I have two components, first is Formik form: </p>
  
  <pre><code>&lt;Formik
    initialValues={{files: []}}
    onSubmit={values =&gt; {
    console.log(values)}}&gt;
      {props =&gt; (
        &lt;form onSubmit={props.handleSubmit}&gt;
          &lt;UploadComponent/&gt;
          &lt;button type="submit"&gt;&lt;/button&gt;
        &lt;/form&gt;
      )}
  &lt;/Formik&gt;
  </code></pre>
  
  <p>Second is UploadComponent:</p>
  
  <pre><code>const UploadComponent = () =&gt; {
    const [files, setFiles] = useState([]);
    const {getRootProps, getInputProps, isDragActive} = useDropzone({
      accept: 'image/*',
      onDrop: acceptedFiles =&gt; {
        setFiles(acceptedFiles.map(file =&gt; Object.assign(file, {
          preview: URL.createObjectURL(file)
        })))
      }
    })
    return (
      &lt;div&gt;
        &lt;div {...getRootProps({className: 'dropzone'})}&gt;
          &lt;input {...getInputProps()} /&gt;
          &lt;p&gt;Drag and drop some files here, or click to select files&lt;/p&gt;
        &lt;/div&gt;
     &lt;/div&gt;
    )
  </code></pre>
  
  <p>I want to get these files as values to Formik, I added some props to UploadComponent, like </p>
  
  <pre><code>value={props.values.files}
  onChange={props.handleChange}
  onBlur={props.handleBlur}
  name='files'
  </code></pre>
  
  <p>I expect to get an array of uploaded files in formik. Instead I get initial value of files (empty array).
  How to get these files and pass them into the formik form byreact-dropzone?</p>