-
-
Notifications
You must be signed in to change notification settings - Fork 229
Fix passing ref to functional components (#153) #156
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
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/react-component/trigger/1y8hdnime |
Codecov Report
@@ Coverage Diff @@
## master #156 +/- ##
==========================================
+ Coverage 85.27% 85.42% +0.14%
==========================================
Files 7 7
Lines 489 494 +5
Branches 136 140 +4
==========================================
+ Hits 417 422 +5
Misses 72 72
Continue to review full report at Codecov.
|
hi @mogzolm, this warning is by expect. Since we don't want user missing passing ref and have to use ref: Line 439 in 2cd87ca
|
Ah, I see. OK so rc-trigger can't really support function components then (without using Alright, that's fair, I'll close this. |
Yes. Before fragment refs RFC merge, we still need this as fallback. ref: reactjs/rfcs#97 |
See issue #153
Previously, using a functional component as the child of a Trigger would cause React to give console errors due to rc-trigger passing a ref to the child, which is not allowed in functional components. This adds a check for functional components and avoids passing them a ref when encountered. Other components (classes and plain elements) are not affected, and will behave the same as before.