Last active
February 13, 2019 13:36
-
-
Save danielkcz/4f84bd77bfef4e743d879212aa53c923 to your computer and use it in GitHub Desktop.
Formik with MobX #3
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
const formik = mobx.observable({ | |
values: props.initialValues || {}, | |
touched: {}, | |
errors: {}, | |
// scalar values needs to be wrapped into another object | |
// otherwise after spreading MobX would lost track of it | |
state: { | |
isSubmitting: false, | |
submitError: null | |
} | |
}) | |
return { getFieldProps, ...formik }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment