This New React Hook Changes How You Use Forms

  Рет қаралды 85,678

Web Dev Simplified

Web Dev Simplified

Күн бұрын

React Simplified Course: reactsimplified.com/?...
React recently announced a new experimental hook that makes working with forms so much easier. This hook solves issues related to double submitting forms, loading states, and so much more.
📚 Materials/References:
React Simplified Course: reactsimplified.com/?...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:57 - Traditional Solution
02:45 - useFormStatus Solution
#ReactJS #WDS #useFormStatus

Пікірлер: 85
@WebDevSimplified
@WebDevSimplified 10 ай бұрын
React Simplified Course: reactsimplified.com/?Udtt6H5CE
@ankitshukla9257
@ankitshukla9257 10 ай бұрын
You can also use use-form-hook
@mahmudaremu4907
@mahmudaremu4907 10 ай бұрын
Please can you make a review of the exchange-router module on npm
@GaryMenzel
@GaryMenzel 10 ай бұрын
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 10 ай бұрын
Yeah I instantly thought reacr-hook-form too. I guess eventually it may be redundant
@dmytrk
@dmytrk 10 ай бұрын
I'm using react-hook-form for this and it gives additional benefits, such as schema validation with various libs (Yup, Zod, etc.)
@MrMudbill
@MrMudbill 10 ай бұрын
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)`.
@axelramirezludewig306
@axelramirezludewig306 10 ай бұрын
Nice one
@Avarn388
@Avarn388 10 ай бұрын
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.
@caincobain9318
@caincobain9318 10 ай бұрын
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.
@withWil
@withWil 10 ай бұрын
This is awesome and will play nice with native HTML form validation.
@mma93067
@mma93067 10 ай бұрын
Mantine’s useform + zod feels light years ahead tho
@NOTHING-en2ue
@NOTHING-en2ue 10 ай бұрын
very great tutorial, thanks a lot ❤
@anonymous_dev9472
@anonymous_dev9472 10 ай бұрын
Kyle, pls bring out a full length react course on youtube 🙏🏻
@user-nv1os5ni1y
@user-nv1os5ni1y 10 ай бұрын
Thanks a lot for this tutorial.
@parassharma7041
@parassharma7041 10 ай бұрын
Thank you🎉
@YourEverydayDeveloper
@YourEverydayDeveloper 10 ай бұрын
react solves problems that react has created in the first place
@joepetrillo6185
@joepetrillo6185 10 ай бұрын
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 10 ай бұрын
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 10 ай бұрын
Always check their documentation
@sicfxmusic
@sicfxmusic 10 ай бұрын
I don't know bro, maybe check their roadmap.
@joepetrillo6185
@joepetrillo6185 10 ай бұрын
@@sicfxmusic ok bro
@bogdanfilimon2486
@bogdanfilimon2486 10 ай бұрын
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).
@hassanshahid9499
@hassanshahid9499 7 ай бұрын
your course is best for React Hooks , Appriciated
@axelramirezludewig306
@axelramirezludewig306 10 ай бұрын
This is truly epic! The php feel
@magicfibre
@magicfibre 10 ай бұрын
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?
@fave1201
@fave1201 10 ай бұрын
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.
@noelethan6230
@noelethan6230 10 ай бұрын
Great tutorial, can see react is getting a PHP feel
@ajlmusic
@ajlmusic 10 ай бұрын
Awesome!
@kaas99
@kaas99 10 ай бұрын
This seems pretty similar to AntD implementation of Form but, it's good to have this out of the box.
@hawarhekmat1174
@hawarhekmat1174 10 ай бұрын
why i love nextjs ❤❤❤❤
@hireetech
@hireetech 10 ай бұрын
Awesome!😍
@ziadx3
@ziadx3 9 ай бұрын
i love this react hook!
@Pedro-yq8ro
@Pedro-yq8ro 10 ай бұрын
Hey Kyle great vid, listen how can I use env vars with vite + react?
@user-cy8mh5sc4n
@user-cy8mh5sc4n 10 ай бұрын
The only channel whose speed I'm slowing down.
@greybluesea
@greybluesea 10 ай бұрын
same here, speed 0.75 for Kyle
@greybluesea
@greybluesea 10 ай бұрын
BTW, does the 'data' of 'FormData' type has a method to allow us to set it blank right after submit?
@govinda399
@govinda399 10 ай бұрын
thanks guruji :)
@helleye311
@helleye311 10 ай бұрын
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.
@williamliu796
@williamliu796 10 ай бұрын
would you use this over react hook form?
@oscardasilva971
@oscardasilva971 10 ай бұрын
I was wondering the same
@wchorski
@wchorski 10 ай бұрын
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 10 ай бұрын
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.
@bikbokken6040
@bikbokken6040 10 ай бұрын
When will your NextJS course be released on your course platform? :D
@TannerBarcelos
@TannerBarcelos 10 ай бұрын
Why this wasn’t the behavior from day 1, idk. But this is a beautiful addition.
@pieter5466
@pieter5466 10 ай бұрын
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.
@LaravelScreencast
@LaravelScreencast 9 ай бұрын
I feel using state is easier, and creating a custom form component😀!
@luisfrocha1
@luisfrocha1 10 ай бұрын
This is pretty much how useFetch works on Nuxt 3, except it doesn't require tying specifically to a form.
@abhinavtariyal6099
@abhinavtariyal6099 10 ай бұрын
What about useNavigation hook? How is it different from this hook?
@tak68tak
@tak68tak 10 ай бұрын
would this affect Next.js Server Action?
@simbarashemaunga5575
@simbarashemaunga5575 10 ай бұрын
Neat, but I will stick to disabling the button though
@chesterxp508
@chesterxp508 8 ай бұрын
GoodJob!
@developer_bola
@developer_bola 10 ай бұрын
Hi Kyle! I need crud app with json server lesssons! Please tech it and upload lesson
@XboxArqain
@XboxArqain 10 ай бұрын
Use react-hook-forms is the best
@gendumaladi9448
@gendumaladi9448 10 ай бұрын
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.
@raistlinmajere2257
@raistlinmajere2257 10 ай бұрын
Why don't you have any angular tutorials?
@firedforfighting
@firedforfighting 10 ай бұрын
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 10 ай бұрын
Data Driven Forms is still a way to go for me. This is really limited. :/
@salixar
@salixar 10 ай бұрын
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.
@Shebu
@Shebu 10 ай бұрын
Same
@YourEverydayDeveloper
@YourEverydayDeveloper 10 ай бұрын
thats exactly what happens
@dixztube
@dixztube 10 ай бұрын
I agree. I’m not doing my next project in react.
@i-am-the-slime
@i-am-the-slime 10 ай бұрын
This can't happen when using RemoteData in PureScript
@TM_LBenson
@TM_LBenson 10 ай бұрын
I always turned my submit button into a spinner until I get a reply from the api
@roycechriston5389
@roycechriston5389 10 ай бұрын
I do the same
@muneebkarim3738
@muneebkarim3738 10 ай бұрын
Bro I am From Pakistan, For me Your courses are too Expensive 🥺🥺
@dixztube
@dixztube 10 ай бұрын
What would be a good usd cost for Pakistan viewers. Impressive you know English.
@usmanabdurehman97
@usmanabdurehman97 10 ай бұрын
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.
@daveckw
@daveckw 6 ай бұрын
isnt this even more complicated than the original isLoading
@Marcosmapf
@Marcosmapf 10 ай бұрын
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
@lucascorey3475
@lucascorey3475 10 ай бұрын
Imagine not using Svelte.
@DanelonNicolas
@DanelonNicolas 10 ай бұрын
I wasn't subscribed... sorry bro, love your channel
@evgeniik_
@evgeniik_ 10 ай бұрын
I am so far away.
@shamaeelahmed3561
@shamaeelahmed3561 10 ай бұрын
I just started react and i don't know what projects to make ..... can anyone help me out
@wishmeheaven
@wishmeheaven 9 ай бұрын
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.
@mdmofazzalhossain77
@mdmofazzalhossain77 10 ай бұрын
not that much helpful. Give us the best way of handling form data without pre rendering
@thesunabsolute
@thesunabsolute 10 ай бұрын
Meh, the old way is easier.
@gregupton6351
@gregupton6351 10 ай бұрын
You should have started the video by saying this is an experimental hook! 🙄
@DannonDARKO
@DannonDARKO 10 ай бұрын
Can we finally stop using todo stuff for react tutorials?
I Cannot Believe React Made A Hook For This
8:45
Web Dev Simplified
Рет қаралды 99 М.
Build a Multistep Form in NextJs Using react-hook-form and ZOD
20:31
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,3 МЛН
Countries Treat the Heart of Palestine #countryballs
00:13
CountryZ
Рет қаралды 27 МЛН
СНЕЖКИ ЛЕТОМ?? #shorts
00:30
Паша Осадчий
Рет қаралды 6 МЛН
How To Create A Navbar In React With Routing
19:16
Web Dev Simplified
Рет қаралды 366 М.
React Hook Form - Complete Tutorial (with Zod)
28:22
Cosden Solutions
Рет қаралды 82 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 453 М.
React Server Components Change Everything
15:48
Web Dev Simplified
Рет қаралды 189 М.
Learn TypeScript Generics In 13 Minutes
12:52
Web Dev Simplified
Рет қаралды 220 М.
This New React Hook Breaks All The Rules And I Love It
7:56
Web Dev Simplified
Рет қаралды 179 М.
10 Tailwind Classes I Wish I Knew Earlier
13:31
Web Dev Simplified
Рет қаралды 163 М.
Speed Up Your React Apps With Code Splitting
16:50
Web Dev Simplified
Рет қаралды 368 М.
React 18 useDeferredValue Hook Crash Course
7:52
Web Dev Simplified
Рет қаралды 67 М.