Formik vs React Hook Form - Let's Build a Login Form

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ธ.ค. 2024

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

  • @fr3fou
    @fr3fou 4 ปีที่แล้ว +12

    i really like react hook form, i used it in react-native and it worked great

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +7

      Yeah, same here, we use it at work, great lib

  • @supfiger
    @supfiger 4 ปีที่แล้ว +8

    у таких людей и дизлайков нет!
    спасибо)

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

    Came here expecting to hear your opinion on one over the other, which one do you prefer? So far I've preferred react-use-form but with the addition of hooks into formik it might be worth giving formik a chance

  • @bibblebabl
    @bibblebabl 4 ปีที่แล้ว +11

    Really great! But are they good dealing with complex forms? On a small ones you couldn’t see the difference, but with field arrays, custom inputs, asynchronous validation, reinitialising, focusing on errors are they still good? At my current job I have often to deal with forms and we are using redux form, but it’s pretty similar with final form (same api), by I really want to try formik and hook form too

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +8

      For us react hook form handles all that, but it could be cool to build a test track for form libraries. Like an ultimate form that contains all the things you've listed here

  • @DariaBrinza-w7u
    @DariaBrinza-w7u 4 ปีที่แล้ว +2

    Exactly what I need right now!

  • @yaldakarimi3772
    @yaldakarimi3772 3 ปีที่แล้ว

    you have such great videos about forms, thank you for creating these tutorials.

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

    Cool! What is better (easier) to conduct unit testing of Fomik and react-hook-form?

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +5

      I'm pretty sure they are on par. Would be cool to compare

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

    Hello, is validationSchema still a useForm option for react-hook-form? I tried to use it with Typescript and it didn't work, I had to create a hook for Yup and add in resolver as it is in an example of the documentation

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

    Спасибо тебе за видео! Очень полезно и информативно!

  • @Elator11777
    @Elator11777 4 ปีที่แล้ว

    Thanks for the video, wonderful content! Keep it up!

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

    how can we use it for complex form in react native which has dropdown and checkbox along with textInput... please help.

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

    Hi, I'm new to React and I'm wondering why we use onChange listeners on each field instead of just listening to the onSubmit form and accessing the values with form.id.value

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +5

      Oh thats to be able to react on changes in the inputs and not only to form submit event. Like for real time input validation

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

    Hey man, thanks for share this with us. I'm using react hook form but on validation I used the yup resolver. I don't need him? Sorry my bad english.

  • @krige
    @krige 3 ปีที่แล้ว

    I would have liked to know which one you prefer and why

  • @AndreaLombardo84
    @AndreaLombardo84 2 ปีที่แล้ว

    Great video Maksim!
    How about useFormik and formik.setValues() from async fetched data? I'm falling in infinite loop and re-rendering if put formik into useEffect dependencies. Any idea?

  • @kimokimo-se3ur
    @kimokimo-se3ur 4 ปีที่แล้ว

    Can we use somethong like FORMSPREE with Formik (useFormik) or React-Hook-Form library ? thank you great content

  • @thecensorguy1237
    @thecensorguy1237 4 ปีที่แล้ว

    Amazing video.There is one issue.I am trying to do it with typescript but when i use validateSchema it throws error which says that validateSchema we cannot pass to it.its simply not working.i tried using @ts-ignore but still same issue.

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว

      could you share an example repo?

  • @amanda2348-g9j
    @amanda2348-g9j 2 ปีที่แล้ว

    I see Formik recommended on React's homepage.

  • @artedza
    @artedza 4 ปีที่แล้ว

    Hi! What can you say about redux-form?

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +4

      Hi! I don't really like it. The api itself is less comfortable to me, and also i dont like that it pollutes the global store, and i like to have control of that

    • @GagikHarutyunyan_dev
      @GagikHarutyunyan_dev 4 ปีที่แล้ว

      ​@@satansdeer1 is it always best practice when we validate our inputs into the component without touching the global store? Thank you for your videos, these are really helpful to me

    • @BsiennKhan
      @BsiennKhan 2 ปีที่แล้ว

      @@GagikHarutyunyan_dev redux documentation itself suggest not to use redux for form state and to use local state, even if on form submit the values needs to go into redux they should be handled in local state.

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

    I choose formik. I used every day, in react and react native. Its really simple to use

  • @teosurch
    @teosurch 2 ปีที่แล้ว

    Смешно, но хоть это и не туториал, а сравнение- я на этом видео наконец-то понял как использовать Formik+yup :)
    У меня помему то не роботал yup когда не через * импортировал

  • @vickylance
    @vickylance 2 ปีที่แล้ว

    Formik cant be used for react native?

    • @rickyalmeida
      @rickyalmeida 2 ปีที่แล้ว

      Yes, it can. There's an example in its documentation: formik.org/docs/guides/react-native

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

    Спасибо

  • @olegmaz3969
    @olegmaz3969 4 ปีที่แล้ว

    Thanks. How to check the new password and the confirm password by react-hook-form?

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว

      Hey, what do you mean by ckecking?

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

      @@satansdeer1 I mean to compare two fields, like repeat password. I resolved this task by two ways: one with validate and getValue and second with yup, schema. Example we need change password, form have three inputs current password, new password, confirm password.

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

    Hello Maksim, great video! I am comparatively new to reactjs, i have used formik twice & i loved it, right now i have to create a complex form containing atleast 25-28 input fields , my senior at work has given me free hand to use any packages, so im confused right now? which one should i use? formik or react-hook-form? I havent used react- hook-form yet but after watching your video i realised it easy. Thanks.

    • @satansdeer1
      @satansdeer1  4 ปีที่แล้ว +5

      There was a good point by Chris Maverick here in the comments about the amount of issues in both libraries. We use react-hook-form at work and I'm very happy with it. So I totally recommend react-hook-form.
      Also, could you list the types of the fields in your form, I'm just curious

    • @SHRAVAN2004
      @SHRAVAN2004 4 ปีที่แล้ว

      @@satansdeer1 Okay thanks! the form is application for a education loan, it includes student's academic details and parent's personal & employment details and all other data required to apply for a loan.

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

      Aha so there will be date pickers, normal text fields, selectors, what else? Will there be file fields? Will there be toggle buttons that enable other fields? Dynamic fields maybe?

    • @SHRAVAN2004
      @SHRAVAN2004 4 ปีที่แล้ว

      @@satansdeer1 Yes, a date picker, file upload, toggle switch, checkbox and radio buttons. Yes dynamic fields and dropdown select.

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

      And yes react hook forms is not dealing well with dynamic fields with default values. Got allot problems. For example imagine that you have dynamic comolex form with checkboxes and input visible if checkbox is active then save that data in localstorage refresh the page and apply it as default values and this is where the problems starts...

  • @amanda2348-g9j
    @amanda2348-g9j 2 ปีที่แล้ว

    So which one is better?

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

    Hi Maksim, I have a question about the latest version of react-hook-form which is 6.9.3 (today) and the yup validation not working with this latest version? It does work on the version of react-hook-form you have in your repo of 5.7.2. Just curious if you have a solution? I'm using RHF for all forms now myself and I know you're a super user :-) of RHF. So I thought you might know what is happening with this issue. Thanks! -Brian

    • @briankiernan4837
      @briankiernan4837 4 ปีที่แล้ว

      Since version 6 of react-hook-form you need to add a resolver for yup... or whatever validation library you're using. I've added and it works now. github.com/react-hook-form/resolvers

  • @riskingeuphoria
    @riskingeuphoria 4 ปีที่แล้ว

    christ, its like everything i wondered about

  • @johnkucharsky6927
    @johnkucharsky6927 2 ปีที่แล้ว

    You could do it much simpler with formik

  • @william3588
    @william3588 4 ปีที่แล้ว

    react hook form!

  • @stephencurry8078
    @stephencurry8078 3 ปีที่แล้ว

    На русском будет?