Skip to content

Commit

Permalink
Merge pull request zaguiini#7 from michelts/add-comment-about-access-…
Browse files Browse the repository at this point in the history
…to-formik-context

Add an entry in the FAQ about the access to formik context
  • Loading branch information
zaguiini authored Aug 8, 2019
2 parents e91598a + 644f775 commit d239354
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ const handleSubmit = useCallback((values) => {

While that `Promise` is pending, the `isSubmitting` flag is set to `true`. The status is set automatically from the return of that `Promise`.

### How do you access the Formik context inside the step form (e.g. for conditional rendering)?

The step form is wrapped inside a [`Formik
component`](https://jaredpalmer.com/formik/docs/api/formik) but his props
aren't propagated to the form component. Anyway, you still have access to the
Formik context through one of these methods:

* by using the [`connect
HOC`](https://jaredpalmer.com/formik/docs/api/connect).
* by using the [`Field
component`](https://jaredpalmer.com/formik/docs/api/field) with a render prop
or a callback function as children.
* by using the `useFormikContext` hook (available in Formik's v2).

## License

MIT
Expand Down

0 comments on commit d239354

Please sign in to comment.