Replies: 4 comments 15 replies
-
Hey, @pandaiolo thanks for the detailed feedback.
|
Beta Was this translation helpful? Give feedback.
-
Hey @bluebill1049 thanks for your quick answer! I think point (The onChange is alo behaving as non standard and trying to put a Please at the minimum add a clear note to the documentation that That will save many developers troubles! I am sticking to my opinion that this is quite debatable pattern :) The React spec allows non checkbox component to hold boolean values. It's a very valid use case and the normal use of Controller (with |
Beta Was this translation helpful? Give feedback.
-
one solution I can have in my head is to introduce |
Beta Was this translation helpful? Give feedback.
-
What do you think about the following to make both checkbox and standard inputs work as expected with boolean values: When the
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there
I updated to RHF v6, good job guys (although it was quite hard to work through all those breaking changes)
One of the issues that came up is when implementing the
Controller
component where we used rhf input before.1. Issue with boolean values
An issue that took me some time to resolve, is with
boolean-value component that are not checkboxes
Example:
The above code does not work because of the following line in the Controller component:
https://github.com/react-hook-form/react-hook-form/blob/master/src/controller.tsx#L60
Because it is appending a
checked
prop in my Select component, instead of normalvalue
:https://github.com/react-hook-form/react-hook-form/blob/master/src/controller.tsx#L149
(it needs to be rewritten with manually passing onChange and value props)
Suggestion:
checked
andvalue
props (not sure if it wouldn't raise some warning though)?2. Improvement suggestion
In our tests, we usually grab fields by their
name
prop, which is quite standard (for eg. in Capybara tests)./ The controller does not forward the name prop to the DOM element, which requires us to manually add it which is redundant (both on the Controller component, and theas
orrender
content).IS there a reason why you are not adding it? It would be a nice addition and would allow us to simplify our code that uses Controller component.
Beta Was this translation helpful? Give feedback.
All reactions