-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[OTHER] Forms validations approach #8031
Comments
react-hook-form is a good option. considering both functionality and ease of use. https://www.react-hook-form.com/ if we want to go more complex then we can go with formik as well. Both have a great community so it's easy to get bugs resolved. |
I think Formik was mentioned in Discord also |
I guess whether or not to use a library is a bigger question since forms has already been deployed, swapping out to a library could be more work up front but perhaps easier in the future. So as I see it we have 2 options:
wdyt? |
I agree, We need to check the libraries for our use cases. both the libraries mentioned are good options. I feel since forms are a core features we could benefit from a library in the long term. We could work on some small POCs for both. I am currently working on formik at work on a react project could explore on it for LinkFree. Then we could decided whether to add the library or add validations on our own. |
@ChinmayMhatre that's awesome! I've never used either library so I may not be the best to assess, but happy to help however makes the most sense. I wonder if anyone in the community already has experience with react hook forms and would be best ot help with the feature comparison |
yes, I have experience with both Formik and React Hook forms. |
I think React Hook Form might be a good choice, If we prefer a more imperative approach and prioritize performance with a smaller bundle size. |
@badrivlog and @ChinmayMhatre since you both seem to understand the two form choices, perhaps we agree upon a list of requirements to compare the two against? Some things I can think of: what else? |
React Hook Form will help write less code while achieving better performance. Does the library appear to be supported well now and likely in the future? How is performance affected bundle size: Accessibility features: Flexibility to extend if needed: Ease of migrating current form solution: Overall, React Hook Form offers a pleasant and developer-friendly experience by providing a simple and intuitive API and focusing on improving the development workflow. |
I'd propose React Hook Form (RHF) as well. I refactored an application to use RHF, and it simplified the code a lot. It's a really great library, and it also works well with Zod (we already use Zod for data validation). |
react-hook-form is a good choice, as we are also using it in our company's project, btw we are using |
@eddiejaoude is this still relevant? I can work the poc for this. I believe react hook form is the suggestion by everyone, We can check the usefulness by testing it on one of the forms? |
Sounds like a good plan 👍 ℹ️ eddiejaoude has some opened assigned issues: 🔧View assigned issues |
Awesome! I'll assign it to me. Will raise a draft PR once I have something. ℹ️ ChinmayMhatre has some opened assigned issues: 🔧View assigned issues |
@ChinmayMhatre @eddiejaoude I suggest you use Zod schema validation with React-hook-form, It will be flawless and future alteration in validation will become too easy. |
The issue has been unlocked and is now ready for dev. If you would like to work on this issue, you can comment to have it assigned to you. You can learn more in our contributing guide https://github.com/EddieHubCommunity/BioDrop/blob/main/CONTRIBUTING.md |
Thank you @psavan1655 - Zod is already in the project should Chinmay wish to use it for this example. |
What would you like to share?
I have noticed some piecemeal issues coming in related to various parts of forms needing client side validation and user feedback. Opening this discussion to make sure we are choosing a universal approach for how to handle all forms with the following in mind:
accessibility
user experience
spam control
etc..
Please add any approaches/considerations to this issue for review. I also believe we should review any issues related to this and make sure all devs are working in the same way to create a more maintainable situation in the future.
Additional information
No response
The text was updated successfully, but these errors were encountered: