Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added smart form component #10939

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GetWrecked99
Copy link

@GetWrecked99 GetWrecked99 commented Sep 16, 2023

This component appears to be a wrapper around the useForm hook.
This wrapper aims to simplify the usage of the form handling logic and provide a more structured and reusable way to manage forms in our application.
We can easily use this component without using useForm hook directly.

Well documented
Added type declaration for it
Added some basic tests

@codesandbox
Copy link

codesandbox bot commented Sep 16, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@hoomantalakian
Copy link

That's an interesting feature. I think it would be useful to incorporate this feature into this Library!

@Moshyfawn
Copy link
Member

Thank you for your time and the contribution, Alireza!

Unfortunately, I don't think we want to expand the RHF API with a component wrapper around the useForm hook as it can easily be done in user-land.

Unless @bluebill1049 thinks otherwise.

@Moshyfawn
Copy link
Member

Additionally, there's a new Form component that encompasses additional request API logic on top of the standard useForm API in RHF

@GetWrecked99
Copy link
Author

Thank you for your response @Moshyfawn

Honestly, it doesn't significantly alter the manner in which you employ it. It hinges upon the developer's preferred approach for implementing the form's logic.
One of the reasons I developed this was its applicability to server components, particularly the recently introduced Next.js app directory feature. You need not concern yourself with utilizing the useForm hook in server components any longer.

form-props

Form-Methods

@bluebill1049
Copy link
Member

Thanks for the awesome contribution @GetWrecked99! Apologies for the late reply. Would you be keen to publish that as your own package? we can include that in the FAQ as an external package to be used by users.

@GetWrecked99
Copy link
Author

Thank you for your response @bluebill1049 and I appreciate your feedback on my contribution. While I'm glad to hear that you found the contribution valuable, I would like to continue improving the feature before considering it as a standalone package.

I plan to work on adding more features and refining the codebase to make it even more robust and user-friendly. Once I feel it's in a more polished state, I'll certainly consider publishing it as its own package.

I'll keep you updated on the progress.

Best Regards,
Alireza

Copy link

stale bot commented Dec 15, 2023

Thank you for your contributions! This Pull Request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Best, RHF Team ❤️

@stale stale bot added the stale label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants