Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

useFormik best practices

Tags:

formik

The formik documentation seems to discourage use of the useFormik hook - but the entire Getting Started tutorial exclusively uses useFormik - so I'm not sure how to proceed - it's very confusing. Is there a downside of using useFormik if I don't need connect, FastField, ErrorMessage, etc.

like image 710
Bob Glass Avatar asked Aug 08 '26 19:08

Bob Glass


1 Answers

I don't think it discourages you to use useFormik, but in most of the use cases it's not necessary, as you won't get any perks of using context api. Field, FieldArray, etc uses formik context internally so you won't be able to use these components. But in my opinion by using this useFormik hook you'll be creating more of your own implementation for these kind of components. But it doesn't hurt to learn that as well as internals of Formik are based on this hook.

like image 58
Muhammad Ali Avatar answered Aug 12 '26 11:08

Muhammad Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!