-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning: A component is changing an uncontrolled input of type text to be controlled. #133
Comments
we may need to ask user to supply default value, either at |
@bluebill1049 Yeah, you got the point, assuming default value might break some input components. |
inline |
I have updated the doc :) take a look hopefully make sense. |
at controller section: https://react-hook-form.com/api#Controller |
It seems that if you use 'reset' with Controller, you must explicitly reset each input to avoid an "Uncontrolled inputs" error. It would be great if this could be mentioned in the Controller docs. |
Thanks 😊 |
Describe the bug
I'm currently using
Controller
with MUI TextField, and it was amazing, but I keep getting this error:Warning: A component is changing an uncontrolled input of type text to be controlled.
, I have to set an empty string to as the default value to solve the problem, which I think it should done it by default.To Reproduce
Steps to reproduce the behavior:
Controller
with MUITextField
Codesandbox link
https://codesandbox.io/embed/react-hook-form-controlled-warning-demo-l7k6h?fontsize=14&hidenavigation=1&theme=dark
Expected behavior
No error/warning
Screenshots
Desktop (please complete the following information):
Additional context
A similar issue that i found from
react-hook-form-input
: react-hook-form/input#31The text was updated successfully, but these errors were encountered: