You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, when using React Hook Form, I expected the rules prop to strictly pertain to validation rules. However, while examining the type definitions and documentation, I discovered that rules can also accept an onChange function.
This code works, and the event gets logged. This implementation seems a bit counterintuitive since it blurs the lines between validation rules and event handlers. From a developer's perspective, it creates confusion. I'm curious to understand the reasoning behind including event handlers like onChange within rules. Additionally, should there be explicit documentation to address this usage? Your clarification would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As a developer, when using React Hook Form, I expected the rules prop to strictly pertain to validation rules. However, while examining the type definitions and documentation, I discovered that rules can also accept an onChange function.
Example:
This code works, and the event gets logged. This implementation seems a bit counterintuitive since it blurs the lines between validation rules and event handlers. From a developer's perspective, it creates confusion. I'm curious to understand the reasoning behind including event handlers like onChange within rules. Additionally, should there be explicit documentation to address this usage? Your clarification would be greatly appreciated.
FYI: @bluebill1049
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions