modular-forms icon indicating copy to clipboard operation
modular-forms copied to clipboard

Pattern for creating a form component

Open cwoolum opened this issue 1 year ago • 4 comments

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?

cwoolum avatar Aug 22 '23 15:08 cwoolum

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

fabian-hiller avatar Aug 22 '23 16:08 fabian-hiller

Based on the docs, it might just make more sense to pass in the retrieved object rather than the routeLoader

cwoolum avatar Aug 22 '23 20:08 cwoolum

If you have ideas for a better DX, I'd love to hear them.

fabian-hiller avatar Aug 22 '23 23:08 fabian-hiller

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 🙂

cwoolum avatar Aug 23 '23 00:08 cwoolum