-
What do you want and why?Forms are tricky, mundane, and always present. We should add a versatile Form component to the new app template that serves as a great starting point for folks. I came across this basic Form + Field code with vanilla React by Swizec. And I think this would be a perfect starting point for this. There's certainly not agreement on the best form library, so I think we can tackle this in two stages:
I really like the form generator concept proposed by Swizec in the linked article. I've used this approach myself several times. This would be used by default regardless of the form library. The generator concept also makes it straightforward for the blitz cli generators to modify the form fields. You can view Swizec code here: https://codesandbox.io/s/staging-frog-cmcgr?from-embed=&file=/src/App.js It's going to be tough to find a perfect solution here that makes everyone happy. The goal is not to have the perfect solution for everyone but to find the least common denominator. If we meet that, then it's a straightforward path for each dev to customize the default to their liking. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
It feels to me like this is where generators can shine, but it doesn't feel super "in scope" for Blitz. Would the vanilla React form always be included in new projects, or would we ask if that's something they want? |
Beta Was this translation helpful? Give feedback.
-
The idea of a generator seems promising and the approach Swizec proposes feels pretty natural. It would be cool to have the forms build out if you run While I'm here, I think react-hook-forms could fit really well with the generator model. There wouldn't me much more to add to get it functioning. |
Beta Was this translation helpful? Give feedback.
-
Sounds like a good plan. Alternatively: https://www.npmtrends.com/react-hook-form |
Beta Was this translation helpful? Give feedback.
-
Form & Field components have been in new apps for awhile now. Related discussion form library options: #768 |
Beta Was this translation helpful? Give feedback.
Form & Field components have been in new apps for awhile now.
Related discussion form library options: #768