NextJS Forms (useFormState, useStatus, useActionState) and Server actions

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • Table of Contents:
    02:27 - setting up the project
    09:51 - hyper ui components
    17:36 - useFormStatus hook
    22:09 - useFormState hook
    28:40 - zod
    01:08:10 - useActionState hook
    #Link to source code on Github
    github.com/eld...

Комментарии • 7

  • @zhenobiikuzo4957
    @zhenobiikuzo4957 22 дня назад

    this is cool, im getting the hang of server actions. Also may i ask why dont u use react hook form? You made this project without using it. Can you tell me when to use it? in new RSC patterns

    • @eldics
      @eldics  22 дня назад

      it is usually a matter of preference. You can use React Hook forms in place of plain native html forms. If you use these hooks in a component, it should be a client component. You can then import it in a server component

    • @zhenobiikuzo4957
      @zhenobiikuzo4957 22 дня назад

      @@eldics so there's no reason to use react hook forms if i would validate in server ?

    • @eldics
      @eldics  21 день назад

      @@zhenobiikuzo4957it doesn’t matter. Validations can be done both on client side and server side. Even with server actions on your form, you can still do client side validations. One cool thing about server actions on forms is that validations can be made even if JavaScript is disabled on the client side.

    • @zhenobiikuzo4957
      @zhenobiikuzo4957 21 день назад

      @@eldics that seems like a better way tbh. too bad shadcn requires react hook form for that approach too.

  • @pranoysarker6475
    @pranoysarker6475 21 день назад

    Sir, Please make some more videos in nextjs

    • @eldics
      @eldics  21 день назад

      Coming right up