Open skyh opened 3 years ago
This has nothing to do with the formik object being useFormik hook and will occur regardless of what you set it to (try with const formik = {}). ESLint recommends useMemo:
"The 'formik' object makes the dependencies of useEffect Hook (at line 28) change on every render. To fix this, wrap the initialization of 'formik' in its own useMemo() Hook. (react-hooks/exhaustive-deps)"
This is done in my v3 PR.
Bug report
Current Behavior
useFormik
hook creates new formik instance each time being calledExpected behavior
Expected
useFormik
hook to return the same instance of formik object if called with the same configReproducible example
The counter is needed to re-render component every second. Please, check the console logs to see unstable
useFormik
hook result.https://codesandbox.io/s/withformik-codesandbox-template-forked-xxpg5?file=/index.js