Austin Shelby
Austin Shelby
  • 17
  • 141 177
React Dynamic Form Tutorial | react-hook-form & zod
In this tutorial you will learn how to build a dynamic React.js form using react-hook-form, zod, and TypeScript.
CLONE REPOSITORY github.com/AustinShelby/Dynamic-React-Form
We will be using the discriminated union validator by zod to build a dynamic form validation schema.
You will learn how to use that custom validation schema with react-hook-form to render dynamic inputs based on form state.
Timestamps:
00:00 Intro
00:40 Form validation schema
02:44 react-hook-form
04:34 Dynamic field
06:24 Submitting form
08:24 Outro
มุมมอง: 11 499

วีดีโอ

React Form Validation Tutorial 2022 | react-hook-form and zod
มุมมอง 8Kปีที่แล้ว
In this tutorial you will learn how to build a form in React with validation using react-hook-form and zod. Clone this project: github.com/AustinShelby/react-hook-form-and-zod-tutorial We will cover how to validate form fields such as an email field, a required checkbox, and radio buttons. You will learn how to use react-hook-form to check different form states like when the form has an error o...
Responsive Images Tutorial 2022 - img srcset and sizes
มุมมอง 4.8K2 ปีที่แล้ว
In this video you will learn how to optimize your website by only loading the most optimal image size depending on the viewport width. We will be going over three different examples step-by-step. We are going to be using the srcset and sizes img attributes. Using these we can tell the browser of all the possible sizes of our image. In addition to that, we can tell in which viewport sizes should...
Bulletproof SaaS Tech Stack 2022 | Next.js GraphCMS Fauna Netlify DigitalOcean
มุมมอง 4272 ปีที่แล้ว
I found this to be the most bulletproof tech stack to build a SaaS business in 2022. We will be covering the best frontend, backend, and hosting solution. My recommendations are: Frontend - Next.js Backend - GraphCMS or Fauna Hosting - Netlify or DigitalOcean App Platform 00:00 - Introduction 00:40 - Tech Stacks 01:20 - Frontend 02:55 - Backend 03:45 - GraphCMS 04:23 - Fauna 05:07 - Hosting & D...
TypeScript and React Tutorial | TypeScript for Beginners
มุมมอง 7672 ปีที่แล้ว
Learn how to use TypeScript with React. While JavaScript is the most popular programming language, it is also the most bug prone one too. In this video you will learn how most JavaScript bugs can be avoided by using TypeScript instead. We will go over how TypeScript help us catch bugs early before we even compile or run our code. Then we will go over an example with React learning how to avoid ...
React Image Comparison Slider | Full Tutorial
มุมมอง 4.3K3 ปีที่แล้ว
In this tutorial, you will learn how to create an image comparison slider using React.js and Tailwind CSS. You don't need any previous experience to do this tutorial as I will show you each step I do. To follow along, clone the source repository from here: github.com/AustinShelby/ImageSlider By the end of this tutorial, you will have learned the necessary skills on how to build a responsive ima...
Multi-Step form with react-hook-form
มุมมอง 42K3 ปีที่แล้ว
In this tutorial, you will learn how to create a multi-step form with react-hook-form. Download the code here: github.com/AustinShelby/Multi-Step-Form We will take a big form and break it down into three separate steps. We will write some custom validation rules to improve the user experience. After watching this tutorial you will have the necessary skills to create your own multi-step forms wi...
How I Got a $60,000 Software Engineer Job Without Experience or a Degree
มุมมอง 9613 ปีที่แล้ว
In this video, I will show you the 7 seven steps I took to get a software engineer job in Germany with a $60,000 salary without experience or a degree. After watching this video you will have the necessary knowledge to decide on what programming languages to learn if you want to get hired. How to format your resume if you don't have any previous experience or a college degree. You will learn ho...
SaaS Founder Day in Life
มุมมอง 1.1K3 ปีที่แล้ว
In this video, I will show you the whole process of adding a new feature for my gaming SaaS side project. The project I'm working on is Hytale Vault www.hytalevault.com/ it is a community for people interested in the game Hytale. I'm adding a voting system to threads. I will show you my test-driven development workflow which allows me to ship features fast and with confidence. We will go over m...
How I Build Websites in 2020
มุมมอง 6273 ปีที่แล้ว
Follow me on Twitter: theAustinShelby My current stack when building forum or agency type websites is: Next.js and TypeScript for the front-end Prismic for the headless content management system Netlify for hosting Zapier for automating form submissions. Next.js and TypeScript allow me to build static sites very quickly and efficiently. Pairing them with a headless CMS like Prismic ...
Tailwind CSS Animation Tutorial
มุมมอง 23K3 ปีที่แล้ว
In this Tailwind CSS tutorial, you will learn how to animate icons using the animation utilities. We will take a look at the default animations and how to customize them. Then, we will create our own custom animations from scratch! By finishing this tutorial you will have the skillset to start using animations on your own projects and to customize them to your liking.
Tailwind CSS 2.0 New Features Breakdown (don't miss these)
มุมมอง 13K3 ปีที่แล้ว
Tailwind CSS version two just got released. It brings out a lot of new features like rings, dark mode, an extended color palette, and a lot more. I will break down all of the new features by building a simple form. We will cover rings that make styling your form inputs so much easier. Checkboxes and how you can style them using only utility classes. Finally, we will try out the new extended col...
Tailwind CSS Buttons Tutorial (don't make these mistakes)
มุมมอง 11K3 ปีที่แล้ว
In this Tailwind CSS tutorial, you will learn how to design and code beautiful buttons using various techniques. You will learn concepts like hierarchy, semantics, and color-theory. This tutorial doesn't require knowledge of Tailwind CSS. In fact, you can use just plain CSS if you wish so. We will use examples from Airbnb, Digitalocean, and Netlify to get inspiration on how they design their bu...
Form Design Tutorial with Tailwind CSS (with examples)
มุมมอง 12K3 ปีที่แล้ว
Form Design Tutorial with Tailwind CSS (with examples)
Alpine.js Crash Course (better than react)
มุมมอง 8K3 ปีที่แล้ว
Alpine.js Crash Course (better than react)

ความคิดเห็น

  • @milanpoudel7212
    @milanpoudel7212 หลายเดือนก่อน

    can't we use same image for this? i mean the image coming from api....I don;t think we save different versions of image while creating blog post or anything

    • @AustinShelby
      @AustinShelby หลายเดือนก่อน

      Usually most content management systems automatically create different versions of the image when you upload one or they provide an API that you can use to fetch different versions of the image with URL search params. For example example.com/image.png?width=400 would fetch an image and resize the width to 400 pixels on the fly. Imgix is one these services that provide this kind of functionality.

  • @user-mx2mo7jx5r
    @user-mx2mo7jx5r 2 หลายเดือนก่อน

    That's awesome ❤ Nothing is better than "Austin Shelby" to learn coding❤

  • @LuisLarreaJr
    @LuisLarreaJr 2 หลายเดือนก่อน

    Great example. I had something similar when product had the bright idea to still show the fields but disabled. Apparently this really complicates things since now you have to disable the validation rules from triggering on disabled fields.

  • @monkeyprogramming776
    @monkeyprogramming776 3 หลายเดือนก่อน

    Thank you Austin, It helped me a lot

    • @AustinShelby
      @AustinShelby 3 หลายเดือนก่อน

      I'm super happy to hear that. Thanks for the encouraging comment!

  • @socialultra7219
    @socialultra7219 4 หลายเดือนก่อน

    cheers dude, I was struggling on this problem for a while, your content helped immensely

    • @AustinShelby
      @AustinShelby 4 หลายเดือนก่อน

      Glat to have helped you solve your problem!

  • @dhanbirsunwar6374
    @dhanbirsunwar6374 6 หลายเดือนก่อน

    Thank you so much, this made my work much easier. very informative and explained so well

  • @Tony.Nguyen137
    @Tony.Nguyen137 6 หลายเดือนก่อน

    Thank you brother. Allahu Wakbar

  • @kacperkepinski4990
    @kacperkepinski4990 6 หลายเดือนก่อน

    there are millions of files on github

  • @kacperkepinski4990
    @kacperkepinski4990 6 หลายเดือนก่อน

    u change only text and u have 2 different buttons thats .....

  • @photoinshot1355
    @photoinshot1355 6 หลายเดือนก่อน

    Excellent tutorial, very well explained and demonstrated, thanks very helpful and useful.

  • @doyouwonmi
    @doyouwonmi 7 หลายเดือนก่อน

    Thank you so much! I finally understood how to use sizes attribute with confidence!

    • @AustinShelby
      @AustinShelby 7 หลายเดือนก่อน

      Glad to have helped!

  • @nickwoodward819
    @nickwoodward819 7 หลายเดือนก่อน

    Hi Austin, sorry for another question! When I move to the next step it seems to populate the next inputs with the previous values. Have you ever come across that behaviour?

  • @nickwoodward819
    @nickwoodward819 7 หลายเดือนก่อน

    Only half way through but loving the video. Out of interest, do you need to use a ref to register the input? I've been using {...register('name', {required: true})} as an attribute and it seems to be working ok?

    • @AustinShelby
      @AustinShelby 7 หลายเดือนก่อน

      Thank you for watching. When I recorded this video the latest version of react-hook-form was 6. Now it's in version 7 where the syntax has changed a little bit. The way you are using it now is correct 👍.

    • @nickwoodward819
      @nickwoodward819 7 หลายเดือนก่อน

      @@AustinShelby Perfect, and thanks for the quick reply!

  • @ObyMikelPS3
    @ObyMikelPS3 7 หลายเดือนก่อน

    Well done thank you

  • @acubesa
    @acubesa 9 หลายเดือนก่อน

    This is great, but what if the form has over 20 fields, I would need to create a copy of it for every version, is there a more 'versatile' way of achieving this? Maybe when setting the definition of a type in the schema, can I co-require a field, instead of creating different possible versions of it? I'm new to zod as you can tell...

    • @acubesa
      @acubesa 9 หลายเดือนก่อน

      Nevermind, I found a more dynamic way to do it, just creating the z.object with the diff, and merging the base schema, so I don't have to create copies for every version.

    • @AustinShelby
      @AustinShelby 9 หลายเดือนก่อน

      @@acubesa I'm glad you found the solution for it and thanks for sharing it with everyone 👍

  • @mrluckyuncle
    @mrluckyuncle 9 หลายเดือนก่อน

    Thanks for the concise and clear explanation and good examples.

    • @AustinShelby
      @AustinShelby 9 หลายเดือนก่อน

      Thank you a lot! Comments like these keep me making new videos.

  • @andywilkes1290
    @andywilkes1290 9 หลายเดือนก่อน

    This has been the clearest and most informative explanation I've found so far. And it also covered how to handle images in a responsive grid layout, and it all now seems to easy and obvious. Thank you, Austin.

  • @davidlew4391
    @davidlew4391 10 หลายเดือนก่อน

    If I have three slides, how can I write the logic of the slide? And make sure the second slider will move when the first slider touches it. Thx!

  • @julio-dev
    @julio-dev 11 หลายเดือนก่อน

    Thanks a lot, as I'm learning by making a little project of my own, this was very useful!

    • @AustinShelby
      @AustinShelby 11 หลายเดือนก่อน

      Hey Julio that's awesome to hear. I wish you good luck on your project. Let me know if you need any help.

  • @VinayKumarSupervisor
    @VinayKumarSupervisor ปีที่แล้ว

    Clean !😀... Thanks

  • @arturpawelski321
    @arturpawelski321 ปีที่แล้ว

    thank you for help ,you are great teacher❤

  • @Supremevillacom-house
    @Supremevillacom-house ปีที่แล้ว

    thanks man

  • @EvgenichTalagaev
    @EvgenichTalagaev ปีที่แล้ว

    I don't understand why <img not loading my images in srcset? <img srcset="<?=SITE_TEMPLATE_PATH?>/img/wildly-relax-767.jpg 767w, /upload/iblock/017/017a40279824ba556009d247f6b7ee76.jpg 1920w" src="<?=SITE_TEMPLATE_PATH?>/img/wildly-relax-767.jpg" alt="Description of the image" /> he is always loading 1920px image

  • @tonyg_nerd
    @tonyg_nerd ปีที่แล้ว

    I just watched this and your other React/Zod vid for the first time. You have some great tips, the vids are clear, concise, and well-edited. I need to rewatch for the detail. Please do keep it up.

  • @shrutisahu6660
    @shrutisahu6660 ปีที่แล้ว

    Thank you so much, Austin. This was really a gem of information. I am gonna try it on my website.

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Glad I could be of help! Let me know how it goes.

    • @shrutisahu6660
      @shrutisahu6660 ปีที่แล้ว

      Hey Austin, your tutorial worked for me. Thanks a ton! 🎉 Just one small question... what is the difference if I use 'srcset' or style="max-width: 100%; height: auto;" attribute to make the image responsive? Also, which is better to go with?

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      @@shrutisahu6660 Image responsiveness can mean two different things. style="max-width: 100%; height: auto;" makes sure that the image fills up its parent container and that its aspect ratio doesn't get skewed. The srcset and sizes attributes make sure that the browser loads the correctly sized image based on the viewport size so you don't actually load a too large image and waste precious bandwidth. They do two different things and are best used together.

    • @shrutisahu6660
      @shrutisahu6660 ปีที่แล้ว

      @@AustinShelby thank you! Now the concept is clear to me 👍🏻 and... Subscribed 🙌🏻

  • @miketepes8208
    @miketepes8208 ปีที่แล้ว

    This will work with zod? I tried it with zod but i cannot get to step 2 cause my step 2 fields also validated when clicking next to step 2.

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      The way I showed it in this video won't work with zod. If you want to use zod I would make each step a separate form with their own validation.

  • @miketepes8208
    @miketepes8208 ปีที่แล้ว

    Thank you very much Sir. I learned a lot. I applied this to checkout page where checkbox is biling address is same with shipping address or not. Thank you very much

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Hey Mike it's awesome to hear that this video helped you! Thanks for watching.

  • @Cruzylife
    @Cruzylife ปีที่แล้ว

    Your repo is outdated

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      That's true this video is already two years old. I might remake this tutorial with the latest tools and best practices.

  • @vimux
    @vimux ปีที่แล้ว

    Saved my life. Thanks for this.

  • @niravdiev4477
    @niravdiev4477 ปีที่แล้ว

    Amazing video! Thank you so much!

  • @mohamedali9249
    @mohamedali9249 ปีที่แล้ว

    thank a lot for thit tutorial, bro i have a question how will it be if you the sections in differents componet, i mean how will you acces to data in different form and submit them in a single, i'm really curious about knowing this

  • @imdipprokash
    @imdipprokash ปีที่แล้ว

    It realy good.

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Thank you for watching!

  • @theaudacity4432
    @theaudacity4432 ปีที่แล้ว

    Thanks for this. I wont have to use calibri sans any more

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Calibri is in a category of its own. Nothing can compare to it.

  • @Thatonemetalsonicfan
    @Thatonemetalsonicfan ปีที่แล้ว

    Where comic sans

  • @pedrol6193
    @pedrol6193 ปีที่แล้ว

    Great video!

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Thanks for watching Pedro! Hopefully my tutorial helped you out!

  • @athefirstletteraofthealpha769
    @athefirstletteraofthealpha769 ปีที่แล้ว

    Thank you, Austin. Your tutorial is very clear and helpful.

  • @zlatkoiliev8927
    @zlatkoiliev8927 ปีที่แล้ว

    Nice tutorial mate. Can you do the same with Next.js and the next router. So each step of the form will be a new route?!?

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Hey Zlatko thanks for watching the video. That sounds like an interesting topic for a tutorial, I'll consider it

  • @mr.random8447
    @mr.random8447 ปีที่แล้ว

    Yeah would love to see how you handle multi-step forms, having zod only validate only fields on a particular step.

  • @raymondmichael4987
    @raymondmichael4987 ปีที่แล้ว

    This is germ by itself 😊

  • @rastaray6401
    @rastaray6401 ปีที่แล้ว

    How do you access errors on the email field? Accessing formstate.errors.email results in a "property does not exist" TypeScript error

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      TypeScript is correct in this case. If the checkbox is not checked there won't be a property email in the formState.errors object. To fix this, you have to first check if the object has the email key like this: "email" in formState.errors && formState.errors.email

  • @Foused87
    @Foused87 ปีที่แล้ว

    Make more videos like this

  • @Foused87
    @Foused87 ปีที่แล้ว

    Why you stopped making videos? Your videos are so helpful!

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Honestly just pure laziness. I should just probably get back to it as people seem to be enjoying these videos.

  • @koreandude
    @koreandude ปีที่แล้ว

    Appreciate the content Austin, subbed and liked! Hope you can continue to create more videos like this

  • @allisfehr
    @allisfehr ปีที่แล้ว

    Great video. Any clue how to use 'refine' with an array instead of a single value (ie. checkbox input)? Something like this except the includes(val) part is giving me an error. optionsList: z.string().array().refine((val) => options.map((option) => option.name).includes(val))

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Hey I managed to fix your problem. So in your example val is an array of string. That's why you cannot use it as an argument in the includes() function. I created this example to show the correct solution: stackblitz.com/edit/typescript-qepcxs?file=index.ts What you should be basically doing is to check if the values in these two arrays intersect. Hope this helps!

  • @liammullan2197
    @liammullan2197 ปีที่แล้ว

    Great video, thanks Austin! (Perfect english btw)

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Thank you for watching Liam!

  • @prasad_yt
    @prasad_yt ปีที่แล้ว

    Very systematic and to the point - well done !

  • @menaaziz27
    @menaaziz27 ปีที่แล้ว

    Glad that I found your channel! Great quality and straight to the point .. Thank you!

  • @HariKrishna-qh5zp
    @HariKrishna-qh5zp ปีที่แล้ว

    its a great tutorial Austin, however I strongly feel you must have adopted some design library as the implementation of Tailwind CSS made this look so clumsy and not on the point to what the video trying to convey. I mostly prefer MUI or Chakra UI for simple and elegant design of forms.

    • @AustinShelby
      @AustinShelby ปีที่แล้ว

      Thanks for watching Hari. While UI libraries like Material UI are useful for creating good looking designs quickly, they cause some extra complexity when integrating form libraries such as react-hook-form.

    • @HariKrishna-qh5zp
      @HariKrishna-qh5zp ปีที่แล้ว

      @@AustinShelby Thanks so much for your response. You are absolutely right. While I was working on a dynamic form similar to the one in the video, I had to disable form fields after checkbox however @Mui latest version's Checkbox is not allowing that functionality.