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

[React] Feature Request: Decouple Form and FormStore creation from components. #209

Open
zthng opened this issue May 27, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@zthng
Copy link

zthng commented May 27, 2024

Hello, is it possible to explore decoupling the creation of the signals store from the creation of the components?

Reason: This would enable us to build form modules that are totally isolated from React (with only @preact/signals-react as the only dependency remaining) and to manipulate the form fully outside of React.

Since it is a signal, we can consume it anytime we like anyway—and as such, we can do the bindings between the modules and React ourselves.

This is from the perspective of a large-scale form. Doing this will allow us to break the form into multiple instances without requiring React to have the component rendered somewhere.

@fabian-hiller
Copy link
Owner

fabian-hiller commented May 27, 2024

Not yet, but it will be in the future. I plan to develop a signal-based and framework-agnostic core that can be plugged into framework-specific components.

What you can do today is replace useForm with useFormStore and then pass the result to child components.

@fabian-hiller fabian-hiller self-assigned this May 27, 2024
@fabian-hiller fabian-hiller added the enhancement New feature or request label May 27, 2024
@zthng
Copy link
Author

zthng commented May 28, 2024

So technically, I could reimplement the guts of the useFormStore hook and pass it anywhere I guess. I'll try that out 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants