hunk.code_window: Because we introduced `initialErrors`, `initialTouched`, `initialStatus` props, `resetForm`'s signature has changed. It now accepts the next initial state of Formik (instead of just the next initial values).
   ### `validate`
   As you may know, you can return a Promise of a validation error from `validate`. In 1.x, it didn't matter if this promise is resolved or rejected as in both cases the payload of the promise was interpreted as the validation error. In 2.x, rejection will be interpreted as an actual exception and it won't update the form error state. Any validation function that returns a rejected promise of errors needs to be adjusted to return a resolved promise of errors instead.
  
hunk.labels: keep keep add keep keep keep keep
hunk.after_edit: ### `setError`
   Please use Formik's `setStatus(status)` instead. It works identically.
  
hunk.file_path: website/versioned_docs/version-2.1.2/migrating-v2.md
hunk.type: add
file: ---
  id: arrays
  title: Arrays and Nested Objects
  custom_edit_url: https://github.com/jaredpalmer/formik/edit/master/docs/guides/arrays.md
  ---
  
  Formik has support for nested objects and arrays out of the box. These 2 subjects are somewhat related because they both leverage the same syntax.
  
  ## Nested Objects
  
  The `name` props in Formik can use lodash-like dot paths to reference nested Formik values. This means that you do not need to flatten out your form's values anymore.
  
  ```jsx
  import React from 'react';
  import { Formik, Form, Field } from 'formik';
  
  export const NestedExample = () => (
    <div>
      <h1>Social Profiles</h1>
      <Formik
        initialValues={{
          social: {
            facebook: '',
            twitter: '',
          },
        }}
        onSubmit={values => {
          // same shape as initial values
          console.log(values);
        }}
      >
        <Form>
          <Field name="social.facebook" />
          <Field name="social.twitter" />
          <button type="submit">Submit</button>
        </Form>
      </Formik>
    </div>
  );
  ```
  
  ## Arrays
  
  Formik also has support for arrays and arrays of objects out of the box. Using lodash-like bracket syntax for `name` string you can quickly build fields for items in a list.
  
  ```jsx
  import React from 'react';
  import { Formik, Form, Field } from 'formik';
  
  export const BasicArrayExample = () => (
    <div>
      <h1>Friends</h1>
      <Formik
        initialValues={{
          friends: ['jared', 'ian'],
        }}
        onSubmit={values => {
          // same shape as initial values
          console.log(values);
        }}
      >
        <Form>
          <Field name="friends[0]" />
          <Field name="friends[1]" />
          <button type="submit">Submit</button>
        </Form>
      </Formik>
    </div>
  );
  ```
  
  For more information around manipulating (add/remove/etc) items in lists, see the API reference section on the `<FieldArray>` component.
  