2
votes

What is the simplest way to force a formik form to show fields in error?

I would like to this for a react storybook to show what our form looks like when a field has an error in it.

Each field in my form will only display an error if it has been touched and its value is not valid.

I can set the initial value of the fields but I can't figure out how to mark then all as touched so that the errors are displayed.

1

1 Answers

0
votes

The Formik test for ErrorMessage might be of some use.

Note the use of setFieldError and setError