question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use functional components as "from"

See original GitHub issue

Describe the bug Popover does not work when a functional component is supplied to the from prop. Error message reads:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

I don’t know if this is intended behavior or not, and I’m not sure how to work around it.

Device/Setup Info: Any device, see snack: https://snack.expo.dev/@insats/sample-popover

Debug Output

calculateRectFromRef - waiting for ref

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SteffeyDevcommented, Feb 24, 2022

Updated readme, added this under troubleshooting section.

1reaction
SteffeyDevcommented, Nov 11, 2021

I’m actually going to re-open this so that I remember to update the documentation to mention this. Thanks for pointing it out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why I can't use an imported component inside a functional ...
I created a customed button 'addImageButton'and imported it to another .js file. It doesn't render the customer button when I try to use...
Read more >
Why hooks are the best thing to happen to React
With React hooks, you can now do all these without switching, using functional components. Hooks make React so much better because you have ......
Read more >
How to Use Functional Components in React - freeCodeCamp
Have you wondered how to create a component in React? To answer, it is as simple as creating a function returning an HTML-like...
Read more >
How to use Syncfusion components with Functional ...
A functional component accepts props as an argument and returns a React element. You cannot use ref on functional components in React because...
Read more >
Don't call a React function component - Kent C. Dodds
I ran into an issue where if I provided a function that used hooks in its implementation and returned some JSX to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found