r/reactjs • • Mar 02 '20

Resource React Hook Form: Performant, flexible and extensible forms with easy-to-use validation

https://react-hook-form.com/
203 Upvotes

39 comments sorted by

View all comments

Show parent comments

3

u/vim55k Mar 02 '20
  1. This solution is not related to the situation that I described - that third party component does not accept ref. And the whole concept of using ref making props passing obscure.

  2. errors passed to the Error component, while it could be passed through context. Look at my codesandbox. Label/wrapper/errror component and the input component are passed all they need through field context.

  3. In my codesandbox there are console log in each components' render and even in the form itself, so it can be proved when they rerender. For example the submit component rerender only when form validness changes. For RHF , I don't remember, it was some time ago, it need to be checked again.

0

u/[deleted] Mar 03 '20

[deleted]

-1

u/vim55k Mar 03 '20 edited Mar 03 '20

Thank you for your reaction, still more answers :)

  1. I don't know how the Control passes the props , if it is by ref, then that specific component had a problem with it. Again it is obscure.

  2. I see it is optional, but there is no example that it actually works without...

  3. Without proof of number of rerenders, I will not believe. And actually in their examples all components are inlined, but what happens if they are child?

With Mobx putting stuff in child, makes less rerenders.

I think because of Mobx it was possible and easy to create fieldContext that do only necessary updates.

I will sometimes try to do lib which will fix RHF shortcomings but without Mobx. I suppose it won't be easy, if possible at all.

0

u/[deleted] Mar 03 '20

[deleted]

0

u/vim55k Mar 03 '20

It is of course your choice to respond or not. Sorry to bother.

My lib is just a solution to some problems. Was RHF answer my needs, I would not create my lib, would happily use RHF and promote it. I do appreciate the investment in RHF, but my main purpose it to show that there are problems with RHF approach and to discuss them.

It is after all a discussion related to form solutions and specific RHF solution. It is not a competition who will write more praises for RHF.