Uh oh!
There was an error while loading. Please reload this page.
Fix passing ref to functional components (#153) - #156
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.
|
mogzol
commented
Jan 10, 2020
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 |
mogzol
commented
Jan 13, 2020
Ah, I see. OK so rc-trigger can't really support function components then (without using Alright, that's fair, I'll close this. |
zombieJ
commented
Jan 14, 2020
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.