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
Add a way to avoid magically passing props to inputs #189
Comments
Another idea is to compare |
In the meantime, anyone running into issues with custom components just needs to make sure their custom components are of a different type than their |
Interesting! I'd take a look at react-is package and its source to find out the best way to do those checks. |
Today, all inputs, selects, text areas, etc. that match
child.type === Input
(or Multiline, or Select, etc) will receive a bunch of props.The problem is that React's
type
comparison is very loose. So, if your component is roughly the same type, it will receive the props. For instance, if you run the array of strings example without customizing the form'sinputComponent
to something other thaninput
, it will pass unnecessary props to the tags input and mess up the behavior (thanks Chi on Discord for providing the example :D).I don't have any solid idea of how to address this. Maybe we could check the child's props and see if there are any clues that this is a custom component (value, defaultValue, name, etc.), and if that's the case, we don't do our magic. But this doesn't feel much better than the current behavior to me.
I'd appreciate suggestions :)
cc @diogob @gustavoguichard
The text was updated successfully, but these errors were encountered: