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

development of hookform/core for alternative frameworks #4

Open
ap0nia opened this issue Jun 16, 2024 · 2 comments
Open

development of hookform/core for alternative frameworks #4

ap0nia opened this issue Jun 16, 2024 · 2 comments

Comments

@ap0nia
Copy link

ap0nia commented Jun 16, 2024

Is your feature request related to a problem? Please describe.

I'd like a Svelte implementation of react-hook-form. I'd like to expose corresponding register hooks that can automatically bind an input element to a store and automatically track changes while optimizing updates.

Describe the solution you'd like

There's an existing implementation of a framework agnostic core library that I'd like to extend. I'd like to use it to build out a proof of concept for Svelte.

I've implemented a version of @hookform/core from the ground up with vanilla JS in mind. Using this core, I built @hookform/react and passed all of the related tests from react-hook-form. My work can be found here: https://github.com/ap0nia/forms.js/tree/main/packages/react

Describe alternatives you've considered

I'm not a big fan of existing solutions for Svelte because it's either type-unsafe or heavily relies on two-way data binding, which is too opaque for my needs.

Additional context

This issue is forwarded from an issue I made at the core library because I'm not sure how visible it is there.

I think a possible point of difficult is divergence of the hookform/core library and its dependents from the main react-hook-form library, since I wrote everything from scratch to emulate the same external behavior, but not necessarily the internals. I'm willing handle the maintenance burden if it enables hookform to be applicable more widely.

I was just really interested in hearing thoughts about this topic, thanks!

@bluebill1049
Copy link
Member

hi @ap0nia thanks for the feature request, let me get this one out first: react-hook-form/react-hook-form#11522 then we can refine the core

@ap0nia
Copy link
Author

ap0nia commented Jun 18, 2024

Thanks, I really love the DX of react-hook-form and I wanted to plug-in the logic into other frameworks. Let me know when it's appropriate for me to contribute to the core, and the best way to go about it.

From the top of my head, an example RFC I could open is a registerElement method which is the equivalent of the ref property returned by the register function. It would provide a vanilla JS way to register an HTMLElement into the form control's logic.

@bluebill1049 bluebill1049 transferred this issue from react-hook-form/react-hook-form Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants