Reusable Create & Edit Form in React (React Hook Form, Zod)

preview_player
Показать описание

VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"

In this video I will show you how to create a reusable create & edit form in React using React Hook Form and Zod. We're going to be going into a form that is already created and we're going to add edit functionality to it in a way that's efficient and follows all of the React best practices and design patterns.
Рекомендации по теме
Комментарии
Автор

Would be great to see some dynamic form content! It adds a lot of complexity I feel

kevinmitchell
Автор

Thanks for this piece. I think I'll have to follow this tut typing the code myself, that way, I'll understand it better.

naziruadam
Автор

Nice idea and video thanks. Just one note, you are already using zod, parsing the user prop with zod would have made the spread for default values unnecessary and the logic a bit cleaner

AviCharlop
Автор

Why didn’t use Controller from react-hook-form, for DatePicker and Select

violabg
Автор

Isn't is better to pass an onSubmit function to the component, the form component doesn't need to know what happens to the submitted data it just interested if the data is valid and you can pass only the form data, not the entire user. That way in the future if there is a 3th action the form needs to do ( can't think of one now :D ) you can just change the on submit function that you pass to the component .

petarmalamov
Автор

Thank you. I will try to refactor my code. 😅.
I use to have create and editform

mDHARYL
Автор

The idea behind this video was very good and clear, but it would be more interesting if you would make a modal like with react-query under the hood. I’ve tried to create a such implementation, but it keeps falling for more than 2 use effects (linked data, one data depends on another). If you would like to create a video about this, I could give you access to the repository.

serbanmarin-eusebiu
Автор

i would love to see, react query with react hook form and zod. since imnt pro with this, react query has different approach with FORM when it comes to mutations, so i couldnt understand it by myself. anyway Great videos!

johndevnoza
Автор

Would you leave the file as is, or decompose it into smaller files?

stefin
Автор

Great video! Question, for a delete form you'd have to create a different form right?

hqasmei
Автор

Any coupon code for your course please 😮

warrenpeace
Автор

I would like some changes to do if I was using this approach cause I would pass initialvalue from parent like add and edit page cause it is more relative than using if else same for handleSubmir fnc.

devGamersCoders
Автор

Can you make more video on clean code and SOLID principle

navedkhan
Автор

Excellent demonstration of how to build an Edit/Add Form with React-Hook-Form and Zod. Thanks, Darius.

{2024-07-09}, {2024-00-01}

Pareshbpatel
Автор

Please make a video on jwt authentication with Redux persist

dipanjanghosal
Автор

really nice video, but I think you don't have to pass the default value for every input manually I think just can use the form default value better

AhmedOsama
Автор

I would like to see how make add edit form with images

shakapaker
Автор

17 minutes for a video on how to receive default values from props. Damn. People be milkin' hard.

ZhulienDI
Автор

Can u please make a video on persisting user data, I'm really confused what to use .There are multiple options like local storage, redux ..etc.

varshithgowdav
Автор

Great video but there is a problem.
lets say you have a user form.
if you want to update a user, password field is optional, so your types and validations have to know that.

Maybe something like this:
resolver: user ? :,

Would be great to see how you would solve that.

JohnSmith-gugl