Last active
December 3, 2017 16:21
-
-
Save erikras/2c19da03bb8a11fd4a6b219020576dba to your computer and use it in GitHub Desktop.
π Final Form Arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createForm } from 'final-form' | |
import arrayMutators from 'final-form-arrays' | |
// Create Form | |
const form = createForm({ | |
mutators: { | |
// potentially other mutators here | |
...arrayMutators | |
}, | |
onSubmit | |
}) | |
// push | |
form.mutators.push('customers', { firstName: '', lastName: '' }) | |
// pop | |
const customer = form.mutators.pop('customers') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment