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

Поделиться
HTML-код
  • Опубликовано: 17 сен 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

  • @pranoysarker6475
    @pranoysarker6475 24 дня назад

    Sir, Please make some more videos in nextjs

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

      Coming right up

  • @zhenobiikuzo4957
    @zhenobiikuzo4957 25 дней назад

    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  25 дней назад

      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 25 дней назад

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

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

      @@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 24 дня назад

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