React Hook Form - useFieldArray

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ต.ค. 2022
  • 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...

ความคิดเห็น • 46

  • @adityatiwari7337
    @adityatiwari7337 ปีที่แล้ว +3

    Thank you Beier! Approaching docs would be much easier now after watching this.

  • @ahofi
    @ahofi 9 หลายเดือนก่อน +2

    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!

  • @noname13345
    @noname13345 6 หลายเดือนก่อน +1

    You sir are great. Thankyou for this awesome library.

  • @budiman-kr5ug
    @budiman-kr5ug 9 หลายเดือนก่อน +1

    Thank you!
    The best human being is the one who benefits others.

  • @jonathonbloomfield8991
    @jonathonbloomfield8991 11 หลายเดือนก่อน +1

    Thanks again for your work on this!

  • @talatkuyuk6556
    @talatkuyuk6556 ปีที่แล้ว +3

    It is very advanced usage of the react hook forms, nice to have it, thanks.

    • @bluebill1049
      @bluebill1049  ปีที่แล้ว +1

      No worries! Give it a try. It's quite powerful.

  • @benphamvan3456
    @benphamvan3456 9 หลายเดือนก่อน +1

    Thank you Bill.

  • @scrapycholo2659
    @scrapycholo2659 ปีที่แล้ว +3

    Absolutely beautiful ❤️ I have to render a form which has nested arrays of objects.... This is far better than formik

  • @rafaelreale8848
    @rafaelreale8848 ปีที่แล้ว +2

    Incredible, now I managed to implement. I didn't understand from the documentation.

  • @jsricochet
    @jsricochet ปีที่แล้ว +2

    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.

  • @HelpOrNot
    @HelpOrNot ปีที่แล้ว +1

    Super nice video. Very helpful

  • @jeremygollehon7631
    @jeremygollehon7631 ปีที่แล้ว +2

    So good. Thank you!

  • @ArtiomNeganov
    @ArtiomNeganov ปีที่แล้ว +1

    Thank you very much! It was very useful.

    • @bluebill1049
      @bluebill1049  ปีที่แล้ว +1

      You are most welcome! So glad to hear that.

  • @jsricochet
    @jsricochet ปีที่แล้ว +6

    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).

  • @barbarojaviervalmasedavazq9713
    @barbarojaviervalmasedavazq9713 ปีที่แล้ว +1

    Thanks, your save my life

    • @bluebill1049
      @bluebill1049  ปีที่แล้ว

      hahaha, glad I can give you a hand.

  • @JJ-nm8sh
    @JJ-nm8sh 10 หลายเดือนก่อน

    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

  • @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.

  • @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

  • @ab_semi
    @ab_semi 2 วันที่ผ่านมา

    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?

  • @pedverse
    @pedverse 11 หลายเดือนก่อน +1

    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

  • @athulgeorge6744
    @athulgeorge6744 ปีที่แล้ว +2

    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  ปีที่แล้ว +1

      Thank you, I will get to it when I can, it's on my todo list.

    • @athulgeorge6744
      @athulgeorge6744 ปีที่แล้ว +2

      @@bluebill1049 thankyou very much, I look forward to your video

  • @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  ปีที่แล้ว +1

      For type checking.

    • @RomanH91
      @RomanH91 ปีที่แล้ว

      @@bluebill1049 Thank you!

  • @budiman-kr5ug
    @budiman-kr5ug 9 หลายเดือนก่อน

    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)

  • @harrisonwell1719
    @harrisonwell1719 4 หลายเดือนก่อน +1

    How to calculate the total for each item if I have a quantity field? Thanks

  • @rujalsapkota3824
    @rujalsapkota3824 ปีที่แล้ว

    How to move item of one useFieldArray to another useFieldArray ? we can use move for one specific fieldArray for moving item....

  • @NARAYANSHARMA-mc1bb
    @NARAYANSHARMA-mc1bb 5 หลายเดือนก่อน

    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.

  • @nickolaki
    @nickolaki 11 หลายเดือนก่อน

    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  11 หลายเดือนก่อน +2

      Have multiple `useFieldArray`?

    • @nickolaki
      @nickolaki 11 หลายเดือนก่อน

      @@bluebill1049 Yeah, I'm stupid. Thanks :)

  • @nawazishali274
    @nawazishali274 ปีที่แล้ว +1

    Explore it's update value function

  • @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

  • @user-nx6cr1zv4o
    @user-nx6cr1zv4o 5 หลายเดือนก่อน

    why the codesandbox does not work?

  • @naywinhlaing7574
    @naywinhlaing7574 ปีที่แล้ว

    I would like to ask about can I try two different arrays ? I mean two different names.

    • @bluebill1049
      @bluebill1049  ปีที่แล้ว +1

      just create two useFieldArray instances and slot them into two different components.

    • @naywinhlaing7574
      @naywinhlaing7574 ปีที่แล้ว +1

      @@bluebill1049 Thank you, Sir! I got it.

  • @spa.3239
    @spa.3239 28 วันที่ผ่านมา

    Accurate closed captions would be appreciated