This New React Hook Changes How You Use Forms

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

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

  • @WebDevSimplified
    @WebDevSimplified  Год назад +3

    React Simplified Course: reactsimplified.com/?Udtt6H5CE

    • @ankitshukla9257
      @ankitshukla9257 Год назад

      You can also use use-form-hook

    • @mahmudaremu4907
      @mahmudaremu4907 Год назад

      Please can you make a review of the exchange-router module on npm

  • @GaryMenzel
    @GaryMenzel Год назад +19

    I'll at least echo some of what has already been said. React Hook Form has a lot of additional features that this new hook wont cover - so I'll be sticking with that. While I don't consider it to be "magic" (clearly the tag now has a context associated with it), it still feels like a little bit of "sleight of hand-ish". In RHF you explicitly have to use their context component to be able to refer to the enclosing form in child components. So there is some level of "mystery" with this new React hook. I can see that it may help isolate naming conflicts but just how many places in a component containing form do you really need a "pending" state? If you are writing tightly-purposed components... maybe once in that component? So I think naming clashes are going to be rare.
    Also, as pointed out, there's not much difference in the amount of code being written and the benefits come more to those using React in a SSR environment - especially where FormData is prominent.

    • @Andy-si1pl
      @Andy-si1pl Год назад

      Yeah I instantly thought reacr-hook-form too. I guess eventually it may be redundant

  • @MrMudbill
    @MrMudbill Год назад +14

    The input ref wasn't really needed in the previous implementation anyway, since you automatically get refs for named inputs within forms in the FormEvent given in onSubmit. You can have a near-identical implementation for onSubmit by doing `const data = new FormData(e.currentTarget)`.

  • @dmytrk
    @dmytrk Год назад +5

    I'm using react-hook-form for this and it gives additional benefits, such as schema validation with various libs (Yup, Zod, etc.)

  • @magicfibre
    @magicfibre Год назад +6

    Is passing a callback to the "action" something that also comes with the new React version, or is it something that exists already?
    If it's available in the current version of React, why aren't we using it instead of onSubmit?

  • @joepetrillo6185
    @joepetrillo6185 Год назад +33

    Does anyone have a guess on when these new hooks will be released as stable? Seems like they should have existed long ago.

    • @Dev-Siri
      @Dev-Siri Год назад +2

      Seems like it will take some more time because this is a fairly recent feature that is a complement to Server Actions (SA are still in alpha)

    • @sokoyaadedolapo5321
      @sokoyaadedolapo5321 Год назад +1

      Always check their documentation

    • @sicfxmusic
      @sicfxmusic Год назад

      I don't know bro, maybe check their roadmap.

    • @joepetrillo6185
      @joepetrillo6185 Год назад

      @@sicfxmusic ok bro

    • @bogdanfilimon2486
      @bogdanfilimon2486 Год назад +1

      These all “new concepts” from react / vercel / nextjs team is taken from Remix. So you can just use Remix and have all the goodies stable (in general).

  • @caincobain9318
    @caincobain9318 Год назад +2

    that's exactly how remix run are handling forms, I was surprised how no one in the comment or even you Kyle did monition it.

  • @williamliu796
    @williamliu796 Год назад +5

    would you use this over react hook form?

    • @oscardasilva971
      @oscardasilva971 Год назад

      I was wondering the same

    • @wchorski
      @wchorski Год назад +1

      it's nice for learning cutting edge, but would never use any alpha/beta in a production product. React Hook Form, is meant to be used in production out of the box

    • @TannerBarcelos
      @TannerBarcelos Год назад +2

      Like William said, in prod I’d stick to RHF, but once this goes stable, I’d be more inclined to use this as it’s built in and requires less package overhead in my bundles.

  • @YourEverydayDeveloper
    @YourEverydayDeveloper Год назад +3

    react solves problems that react has created in the first place

  • @mma93067
    @mma93067 Год назад +17

    Mantine’s useform + zod feels light years ahead tho

  • @anonymous_dev9472
    @anonymous_dev9472 Год назад +1

    Kyle, pls bring out a full length react course on youtube 🙏🏻

  • @fave1201
    @fave1201 Год назад +2

    Nice video. I prefer the first method though. At times, there may be some logic to be done like show a toast and just having one loading state that's your single source of truth seems easier and more straightforward.

  • @kaas99
    @kaas99 Год назад +1

    This seems pretty similar to AntD implementation of Form but, it's good to have this out of the box.

  • @helleye311
    @helleye311 Год назад +2

    if only this wasn't formdata I'd be excited. But I really don't like working with that. I mean sure it's native and it technically makes sense, but json is just so much nicer most of the time. Only time I use FormData is with file upload, and I always hate every minute of it.

  • @hassanshahid9499
    @hassanshahid9499 10 месяцев назад

    your course is best for React Hooks , Appriciated

  • @Avarn388
    @Avarn388 Год назад +1

    Nice. It was just dealing with this bug in my application so seeing this being addressed with a new hook, it’s right up my alley. Thank you.

  • @user-nv1os5ni1y
    @user-nv1os5ni1y Год назад

    Thanks a lot for this tutorial.

  • @salixar
    @salixar Год назад +9

    geez React gets overloaded with hooks that are really just workarounds for basic stuff. Instead of clean code we get a bunch of functions that have some "magic" going on under the hood. Maaan as I get older, I tend to dislike React very much.

  • @NOTHING-en2ue
    @NOTHING-en2ue Год назад

    very great tutorial, thanks a lot ❤

  • @bikbokken6040
    @bikbokken6040 Год назад

    When will your NextJS course be released on your course platform? :D

  • @axelramirezludewig306
    @axelramirezludewig306 Год назад

    This is truly epic! The php feel

  • @noelethan6230
    @noelethan6230 Год назад

    Great tutorial, can see react is getting a PHP feel

  • @user-cy8mh5sc4n
    @user-cy8mh5sc4n Год назад +1

    The only channel whose speed I'm slowing down.

    • @greybluesea
      @greybluesea Год назад

      same here, speed 0.75 for Kyle

  • @greybluesea
    @greybluesea Год назад

    BTW, does the 'data' of 'FormData' type has a method to allow us to set it blank right after submit?

  • @Pedro-yq8ro
    @Pedro-yq8ro Год назад

    Hey Kyle great vid, listen how can I use env vars with vite + react?

  • @abhinavtariyal6099
    @abhinavtariyal6099 Год назад

    What about useNavigation hook? How is it different from this hook?

  • @ziadx3
    @ziadx3 Год назад

    i love this react hook!

  • @parassharma7041
    @parassharma7041 Год назад

    Thank you🎉

  • @tak68tak
    @tak68tak Год назад

    would this affect Next.js Server Action?

  • @hireetech
    @hireetech Год назад

    Awesome!😍

  • @LaravelScreencast
    @LaravelScreencast Год назад

    I feel using state is easier, and creating a custom form component😀!

  • @gendumaladi9448
    @gendumaladi9448 Год назад

    Still too many line codes. If It was related tô the structure of the like a paramater telling to "wait" the onclick function to happen.

  • @hawarhekmat1174
    @hawarhekmat1174 Год назад

    why i love nextjs ❤❤❤❤

  • @ajlmusic
    @ajlmusic Год назад

    Awesome!

  • @pieter5466
    @pieter5466 Год назад +1

    The first minute of this video reminds me of how important consistent dog-fooding of your own [company's] application is.
    You can't just develop on your local machine, and under/for your own circumstances, technical and other.
    You must incorporate a realistic range of devices, network/speed ranges, screen sizes, etc. into your dev iterations, AND frequently use your app out in the wld.

  • @luisfrocha1
    @luisfrocha1 Год назад

    This is pretty much how useFetch works on Nuxt 3, except it doesn't require tying specifically to a form.

  • @TannerBarcelos
    @TannerBarcelos Год назад

    Why this wasn’t the behavior from day 1, idk. But this is a beautiful addition.

  • @govinda399
    @govinda399 Год назад

    thanks guruji :)

  • @simbarashemaunga5575
    @simbarashemaunga5575 Год назад

    Neat, but I will stick to disabling the button though

  • @developer_bola
    @developer_bola Год назад

    Hi Kyle!
    I need crud app with json server lesssons!
    Please tech it and upload lesson

  • @raistlinmajere2257
    @raistlinmajere2257 Год назад

    Why don't you have any angular tutorials?

  • @XboxArqain
    @XboxArqain Год назад

    Use react-hook-forms is the best

  • @daveckw
    @daveckw 9 месяцев назад +1

    isnt this even more complicated than the original isLoading

  • @Marcosmapf
    @Marcosmapf Год назад

    4:20 lost me on creating a new and unecessary abstraction just to provide context to the tool, doesn't feel like a good syntax

  • @chesterxp508
    @chesterxp508 10 месяцев назад

    GoodJob!

  • @i-am-the-slime
    @i-am-the-slime Год назад

    This can't happen when using RemoteData in PureScript

  • @firedforfighting
    @firedforfighting Год назад

    Personally I feel this is just unecessary, maybe for really complex multistep forms like a visa application software I can understand but to me there is no way that your initial solution or a oneline debounce function is more complicated than implementing all of this especially compared to your complaints being "an extra loading variable??, difficult getting names correctly??" like what?, I'm happy for the vid though

  • @richardvsiansky6950
    @richardvsiansky6950 Год назад

    Data Driven Forms is still a way to go for me. This is really limited. :/

  • @wishmeheaven
    @wishmeheaven Год назад +1

    1. I'll pretend that I managed to follow everything you said.
    2. It is not the first time that you are uploading content of hooks with an experimental status.
    And what if the experiment will fail..?
    I find this urgency for being the first one talking about it, at least......
    Questionable.

  • @TM_LBenson
    @TM_LBenson Год назад +1

    I always turned my submit button into a spinner until I get a reply from the api

  • @muneebkarim3738
    @muneebkarim3738 Год назад

    Bro I am From Pakistan, For me Your courses are too Expensive 🥺🥺

    • @dixztube
      @dixztube Год назад

      What would be a good usd cost for Pakistan viewers. Impressive you know English.

    • @usmanabdurehman97
      @usmanabdurehman97 Год назад

      You don't need to buy anything. There is enough free material present on the internet to learn from. I am a self taught developer and learnt everything for free.

  • @DanelonNicolas
    @DanelonNicolas Год назад

    I wasn't subscribed... sorry bro, love your channel

  • @lucascorey3475
    @lucascorey3475 Год назад

    Imagine not using Svelte.

  • @borjinator
    @borjinator Месяц назад

    The fact that this is an experimental feature was not put into the title or thumbnail, giving this a thumb down.

  • @evgeniik_
    @evgeniik_ Год назад

    I am so far away.

  • @mdmofazzalhossain77
    @mdmofazzalhossain77 Год назад

    not that much helpful. Give us the best way of handling form data without pre rendering

  • @HarryHobbit
    @HarryHobbit Год назад

    You should have started the video by saying this is an experimental hook! 🙄

  • @thesunabsolute
    @thesunabsolute Год назад

    Meh, the old way is easier.

  • @shamaeelahmed3561
    @shamaeelahmed3561 Год назад

    I just started react and i don't know what projects to make ..... can anyone help me out

  • @DannonDARKO
    @DannonDARKO Год назад +1

    Can we finally stop using todo stuff for react tutorials?