React Hook Form - useFieldArray

  Рет қаралды 74,129

Beier Luo

Beier Luo

Жыл бұрын

In this session, we are taking a look at the useFieldArray custom hook to manage your dynamic form fields.
working example: codesandbox.io/s/usefieldarra...

Пікірлер: 53
@adityatiwari7337
@adityatiwari7337 Жыл бұрын
Thank you Beier! Approaching docs would be much easier now after watching this.
@cloudsss83
@cloudsss83 21 күн бұрын
amazing stuff... i'm creating a form that it is supposed to be loaded with server data, and it allows users to update this data. The summary at the end that needs only the changed fields is giving me a headache, but your videos are helping me a lot. Thanks!
@budiman-kr5ug
@budiman-kr5ug Жыл бұрын
Thank you! The best human being is the one who benefits others.
@ahofi
@ahofi Жыл бұрын
One of the better coding tutorials. Mostly I was just interested in the usage, eg for append and field arrays in general. I followed along and all works great. Keep up the good work!
@talatkuyuk6556
@talatkuyuk6556 Жыл бұрын
It is very advanced usage of the react hook forms, nice to have it, thanks.
@bluebill1049
@bluebill1049 Жыл бұрын
No worries! Give it a try. It's quite powerful.
@rafaelreale8848
@rafaelreale8848 Жыл бұрын
Incredible, now I managed to implement. I didn't understand from the documentation.
@jonathonbloomfield8991
@jonathonbloomfield8991 Жыл бұрын
Thanks again for your work on this!
@noname13345
@noname13345 9 ай бұрын
You sir are great. Thankyou for this awesome library.
@jsricochet
@jsricochet Жыл бұрын
Great video. That's exactly the use case I had: allowing the user to dynamically add extra items to an estimate or to a receipt :) It's also great you use TypeScript in your videos as its really becoming more and more required in lots of job offers (React + TS).
@jsricochet
@jsricochet Жыл бұрын
Working great! The only issued I had was 'Uncaught TypeError: methods is null'. It was simply because I imported 'Control' from 'react-hook-form' (KO) instead of destructuring 'control' (lower case 'c') from the object returned by useForm() (OK). Thanks again from this great video. It's great the cursor is also set properly on a field added by the user when there is an error (like a required field with no value provided by the user). :)
@bluebill1049
@bluebill1049 Жыл бұрын
Yea, I believe focus management is really important for accessibility.
@longnq3
@longnq3 2 ай бұрын
Thanks for sharing
@HelpOrNot
@HelpOrNot Жыл бұрын
Super nice video. Very helpful
@ArtiomNeganov
@ArtiomNeganov Жыл бұрын
Thank you very much! It was very useful.
@bluebill1049
@bluebill1049 Жыл бұрын
You are most welcome! So glad to hear that.
@jeremygollehon7631
@jeremygollehon7631 Жыл бұрын
So good. Thank you!
@bluebill1049
@bluebill1049 Жыл бұрын
Most welcome! thank you.
@benphamvan3456
@benphamvan3456 Жыл бұрын
Thank you Bill.
@harrisonwell1719
@harrisonwell1719 7 ай бұрын
How to calculate the total for each item if I have a quantity field? Thanks
@aulyaaryansyah6974
@aulyaaryansyah6974 Ай бұрын
thanks man
@JJ-nm8sh
@JJ-nm8sh Жыл бұрын
great video. what approach would you say would be best for using react hook form with a custom build select (so not using native element) - any demos? Thanks
@barbarojaviervalmasedavazq9713
@barbarojaviervalmasedavazq9713 Жыл бұрын
Thanks, your save my life
@bluebill1049
@bluebill1049 Жыл бұрын
hahaha, glad I can give you a hand.
@ab_semi
@ab_semi 3 ай бұрын
Hello, thank you for the video. I have a question though: I want to have a language set with three select fields with options: first is "Language", second is "Oral Skill for this language" and "Writing skill for this language". However, I want initially only "language" field to appear, and only after selecting a language (i.e. giving it value), I want two other fields to appear. And the append button should become disabled as soon as I added a language, until we selected all three selects. N.B. I can not use onChange or OnValueChange functions. Does it still work because of watch?
@user-se6mi3fe8w
@user-se6mi3fe8w 9 күн бұрын
I need to store objects removed from useFieldArray remove method to another array for subsequent use. How can I achieve this?
@nataliaduran8051
@nataliaduran8051 Жыл бұрын
Thanks for the video!! I tried this hook but notice that the state of the newly generated field created with the append method, doesn't look like expected, for example, the field is generated with the isDirty state as true by default. I am using the React Hook Form DevTools. By any chance have you seen this behavior before? Thanks in advance
@pedverse
@pedverse Жыл бұрын
fought literally week against usefieldarray xd less than 10min from video, and were able to finish my stuff. mby next time i check tutorials or read stuff before i start trying
@alexjjwu
@alexjjwu Жыл бұрын
Hi Beier, thank you for the great tutorial!! But I really want to know how to validate these "name fields" have the same value! It doesn't make any sense that user can type the same value over and over again.
@athulgeorge6744
@athulgeorge6744 Жыл бұрын
Hey can you make a video of using react hook form with Zod and TS that passes register and errors into custom input components that, so UI can be standard instead of always having to build it out everytime, thankyou. Also great videos so far, I've learned alot, very useful.
@bluebill1049
@bluebill1049 Жыл бұрын
Thank you, I will get to it when I can, it's on my todo list.
@athulgeorge6744
@athulgeorge6744 Жыл бұрын
@@bluebill1049 thankyou very much, I look forward to your video
@budiman-kr5ug
@budiman-kr5ug Жыл бұрын
it cannot infer the fields type when using it on other component file inside form context area, where we are not passing the control props (optional if using form context)
@NARAYANSHARMA-mc1bb
@NARAYANSHARMA-mc1bb 8 ай бұрын
Hello Sir, can we make name field will be unique when user try to submit then get error like name field should be unique on particular field.
@rujalsapkota3824
@rujalsapkota3824 Жыл бұрын
How to move item of one useFieldArray to another useFieldArray ? we can use move for one specific fieldArray for moving item....
@RomanH91
@RomanH91 Жыл бұрын
Thanks for your demo! Have a question... Why do you use the dot here`cart.${index}.name`? When in other examples without the dot. Thanks for the answer
@bluebill1049
@bluebill1049 Жыл бұрын
For type checking.
@RomanH91
@RomanH91 Жыл бұрын
@@bluebill1049 Thank you!
@notoreofreakshake
@notoreofreakshake 2 ай бұрын
hello, can i use this in a controller
@user-nx6cr1zv4o
@user-nx6cr1zv4o 8 ай бұрын
why the codesandbox does not work?
@timothyduncanmacahilig1378
@timothyduncanmacahilig1378 Жыл бұрын
hello sir i have a problem i want to get total in useFieldArray example append name price1 amount1 total1 when i click append again total2 autoamtically get valuei in total1
@nawazishali274
@nawazishali274 Жыл бұрын
Explore it's update value function
@z44-huynhkhangvy52
@z44-huynhkhangvy52 10 күн бұрын
Is it required with array of objects sir? I wanna use array of string instead, but typescript warns me with append("")
@incognito14x2
@incognito14x2 5 күн бұрын
zdid you find the solution? typescript complains about typing
@nickolaki
@nickolaki Жыл бұрын
How would you manage multiple uses of useFieldArray? Say you had carts, items and products that were all arrays in the form object.
@bluebill1049
@bluebill1049 Жыл бұрын
Have multiple `useFieldArray`?
@nickolaki
@nickolaki Жыл бұрын
@@bluebill1049 Yeah, I'm stupid. Thanks :)
@naywinhlaing7574
@naywinhlaing7574 Жыл бұрын
I would like to ask about can I try two different arrays ? I mean two different names.
@bluebill1049
@bluebill1049 Жыл бұрын
just create two useFieldArray instances and slot them into two different components.
@naywinhlaing7574
@naywinhlaing7574 Жыл бұрын
@@bluebill1049 Thank you, Sir! I got it.
@spa.3239
@spa.3239 3 ай бұрын
Accurate closed captions would be appreciated
@LinhVu-wz5nq
@LinhVu-wz5nq 2 ай бұрын
Thank you
React Hook Form - Complete Tutorial (with Zod)
28:22
Cosden Solutions
Рет қаралды 99 М.
UseEffect Mistakes Every Beginner Should Avoid
18:05
PedroTech
Рет қаралды 28 М.
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 8 МЛН
V6 - React Hook Form - building dynamic form (Field Array)
20:18
React Hook Form Tutorial - 15 - Dynamic Fields
9:35
Codevolution
Рет қаралды 63 М.
Node JS: Modern Backend Development
32:39
Mr. Wellick
Рет қаралды 687
React Hook Form - useForm: watch
11:11
Beier Luo
Рет қаралды 78 М.
Multistep Form Custom Hook With React And TypeScript
28:23
Web Dev Simplified
Рет қаралды 147 М.
Goodbye, useEffect - David Khourshid
29:59
BeJS
Рет қаралды 497 М.
React Dynamic Form Tutorial | react-hook-form & zod
9:05
Austin Shelby
Рет қаралды 12 М.
React Hook Form V7 - Get Started
15:52
Beier Luo
Рет қаралды 91 М.
Expando Forms in React Hook Form
18:37
Jack Herrington
Рет қаралды 9 М.