-
Notifications
You must be signed in to change notification settings - Fork 77
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
ref error when wrapping stateless functional component #30
Comments
Thanks for this report. The |
Just to clarify: this error means that the |
We should do what redux does and make this opt-in: reduxjs/react-redux@2d3d0be |
Would accept any pull-request that implements the same solution as the linked react-redux code. |
Stateless components cannot use refs, so this adds the withRef option (enabled by default for compatibility) which enables or disables passing the wrappedInstance ref to the wrapped component. Addresses issue digidem#30. Inspired by reduxjs/react-redux@2d3d0be
Stateless components cannot use refs, so this adds the withRef option (enabled by default for compatibility) which enables or disables passing the wrappedInstance ref to the wrapped component. Addresses issue digidem#30. Inspired by reduxjs/react-redux@2d3d0be
Another approach would be to use a child function as react-virtualized/AutoSize is doing it |
Stateless components cannot use refs, so this adds the withRef option (enabled by default for compatibility) which enables or disables passing the wrappedInstance ref to the wrapped component. Addresses issue digidem#30. Inspired by reduxjs/react-redux@2d3d0be
Is it possible to merged this in? |
If you use
Dimensions
to wrap a stateless functional component it complains but still seems to work.will give
Warning: Stateless function components cannot be given refs (See ref "wrappedInstance" in SomebodyCaresAboutDimensions created by DimensionsHOC). Attempts to access this ref will fail.
The text was updated successfully, but these errors were encountered: