This is the next.js form validation library you need to try out
HTML-код
- Опубликовано: 18 май 2024
- My Products
🏗️ WDC StarterKit: wdcstarterkit.com
📖 ProjectPlannerAI: projectplannerai.com
🤖 IconGeneratorAI: icongeneratorai.com
📝 ThumbnailCritique: thumbnailcritique.com
Useful Links
💬 Discord: / discord
🔔 Newsletter: newsletter.webdevcody.com/
📁 GitHub: github.com/webdevcody
📺 Twitch: / webdevcody
🤖 Website: webdevcody.com
🐦 Twitter: / webdevcody
Dang babe! You’re a machine!! Good job as usual ❤
Conform is the best approach right now available. React-hook-from team is also working to make react-hook-from progressively enhanced and will work smoothly in future.
I'm fairly sure all those shadcn wrappers with useForm are optional, you could recreate identical code and functionality with your basic inputs just following the react hook form docs. The shadcn helpers come in handy when you need to integrate with a controlled react component I think
I usually don´t go for SaaS templates - but this one is beginning to look golden
Thank you for this! Really enjoy these "what I'm working on" vids.
I'll try this out in my current project for sure, didn't like how convuluted forms can get with other libraries.
For the red line issue, I think you can try switching the typescript to use workspace version instead of using vscode version.
Awesome, thanks for sharing! I agree the react-form-hook setup is everywhere throughout our codebase at work. I'd been hoping to slim it down, so I'm definitely gonna try this out.
Nice, react hook form make me anxious ahah
This looks really cool! I've been using shadcn forms for the last couple of months and there's just sooo much code for even a simple register form... Coming from a sveltekit world where superform is a thing, this seems like a good contender.
Thanks Cody!
Nice, we’ll take a look. My goto is react hook form. You’re right, it does take a lot to get a simple form running, but it is what it is. Coming from my php days it’s all good though.
You could use tanstack query with your actions to get pending and error states?
Is it better than react-hook-form? Does it makes better the experience of handling 20+ fields? Does it have a nice type-safety experience too?
I think react hook form is still our best option, but it doesn’t support progressive enhancement from what I understand
Conform has smaller API surface, feels better. But the docs are abysmal.
I played around with shadcn forms for very little bit and it seems to me their wrapper components complicate more things than solve. I don't find them useful at all
they are indeed very useful for form validation, validation error messages and integrating the useful utilities that the useForm hook provides. All of this by just copy-pasting code from their website and making changes as necessary.
Can you do a video about Dokploy , the alternative for vercel?
I use formik till date. It just feels easy for form validation
Hi cody can you upload an updated video on hosting a nextjs new created app on AWS with SST?
Thanks!
Could you share your user settings.json?
It looks super cool but when I tried it I was not able to make it work with next-safe-action... I will stick with with react-hook-form for now
After having tried many approaches I've settled for plain forms + server action returning validation errors + a SubmitButton component showing a spinner via useFormState + basic html client side validation. Less than half the code and headache than with all those libraries
Yeah, less code but I like that extra client side custom validation polish
The thing you have with react-hook-form is the typing, which I don't see here. I like how every field's value has its proper typing, all granted from RHF. The code is a little trade-off, which, by the way, I think you could add an extra abstraction to the shadcn form and make it look nicer. As for now, I don't see any form validator that would make me switch from RHF because of all those things such as typing and code suggestions.
I will say I’ve already run into this lack of typing issue. Also this library doesn’t seem to reset the form after submit. Back to RHF for me
Watch out for the Tanstack Form
What extension are you using to display the errors on the editor?
That's "error lens" if I'm not wrong.
@jeromemarshall9248 Thanks, I'll check it out.
Error lens
I also have been having trouble with automatic imports in a brand new next project.
Bro for real idk what’s going on but it’s killing me
How to handle global exceptions in action❤
honestly ive been married to zod since you first introduced it to me way back then
I think it's a bit unfair to compare react-hook-form + shad-cn to just pure reaxct and jsx + this conform library. shad-cn and react-hook-form provide more than just form validation
Honestly if you are a developer who's spending all your time learning every library, you will later realize you are just wasting your time. (unless you are a content creator)
There are benefits to exposing yourself to new ways to achieve things. You get to understand trade offs.
Looks similar to using yup and formik.
I don't use Nextjs. So...
But yet you still watched a video on nextjs 🧐
I don't use nextjs, i don't even code in js or ts
But it seems nice . I would try it for my next personal project.
@@WebDevCody
hopefully the signals proposal makes it to stage 4 and turns next.js/react into jquery. i would host a celebration with my coworkers.