Best method for mocking the FormikProvider when using the useFormik hook #3028
Unanswered
mpconsultsai
asked this question in
Q&A
Replies: 2 comments 3 replies
-
|
OK if i wrap the component in |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
I was also running into the same type of error that @moiz-frost pointed out. That lead me to this page and I tried to follow the recommendation.. however I am getting this error now: "TypeError: Cannot read properties of null (reading 'useRef')" What am I doing wrong? This is my code: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently building a form using Formik which I am relatively new too. Each section of the form is split into its own component which contains many Formik "Field" components.
Using React testing library for a section of the form under test, when I run my tests I get a strange
[TypeError: formik.getFieldProps is not a function]error which seems can be solved by wrapping the component in a FormikProvider.On of the props of this provider is required which is "value" - which I am passing in, in my main form using the useFormik hook.
Beta Was this translation helpful? Give feedback.
All reactions