modular-forms
modular-forms copied to clipboard
Pattern for creating a form component
I am trying to create a form component that can be reused across both create and edit routes. The problem I'm running into is that routeLoaders
can only be defined in routes and can't be serialized to be passed in as props to components. Is there a pattern we can use for creating these forms that can be used in multiple places?
Maybe the following links will help you:
- https://modularforms.dev/qwik/guides/create-your-form#static-values
- https://qwik.builder.io/docs/advanced/routing/#plugints
Based on the docs, it might just make more sense to pass in the retrieved object rather than the routeLoader
If you have ideas for a better DX, I'd love to hear them.
I'll see if I think of anything while I'm building this out. I'm really new to Qwik so I'm still trying to learn a lot 🙂