-
Notifications
You must be signed in to change notification settings - Fork 4.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: ref
is not a prop
#2181
Comments
#1646 appears to be causing warnings for me ([email protected], [email protected]). I'm using ref={r=>this.selector = r} and getting: Warning: CreatableSelect: ref is not a prop. Trying to access it will result in undefined being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://fb.me/react-special-props) I believe this is because ref is reserved, so you can't really pass it through like you are. If you renamed it to selectRef for Creatable (and updated the documentation for this exception to the Select API) I believe that would solve the issue. My code seems to still work ok (it was working before upgrading from rc10), but I'd like to get rid of the warning if possible. |
I am also seeing this warning in the console, it would be great to be able get rid of it. This is with react 16.2.0 & react-select 1.2.0 |
Also got this warning. |
As a temporary solution, you can wrap Creatable in class-based component like this: import { Creatable as ReactSelectCreatable } from 'react-select'
class Creatable extends React.Component {
render() {
return <ReactSelectCreatable {...this.props} />
}
} Or wrap in toClass, if you are using recompose |
I am also seeing this error, but oddly, only via react-virtualized-select. When I use the component directly, it presents no problems. The error, as far as I can tell, refers to the |
Any updates regarding this? |
+1 |
I get this warning. I am using ref on a Creatable to clear the inputValue after creating a new entry.
Using "innerRef" does not work. Anyone know of an alternate method? |
If someone needs a workaround - here it is. It worked perfectly for me. Pass this function to children.
|
I found that there is an extra level of indirection with a Creatable. So for the following code:
In order to get to the actual select reference to clear a value, you will need (note the 2 select):
|
Hello - In an effort to sustain the We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version. If you aren't using the latest version of However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you! |
I think the fact that multiple people reported this issue, without a fix ever being pushed, is an indication that "this issue is still relevant." |
Thanks for the feedback @AleksandrHovhannisyan. |
Sorry for that little outburst, lol. I solved my issue using |
GIven the use of If there are any other objections, we can re-open but our intention is to close older issues to create greater transparency on what is left to stabilize and improve react-select and not to leave anyone feeling unsupported for closing out a 3yr old issue on a deprecated version. |
Hello,
I am using ref in <Select.Creatable ref={(node) => this.selector = node} /> and getting this warning:
CreatableSelect:
ref
is not a prop. Trying to access it will result inundefined
being returned. If you need to access the same value within the child component, you should pass it as a different prop.The text was updated successfully, but these errors were encountered: