Using component children
See original GitHub issueThe current way to use a component children with tippy is to either use forwardRef or to wrap the component in a span tag.
However, I was wondering if by any chance there was another way to make it work ?
I just updated to the latest version of tippy and putting forwardRef everywhere is not maintainable. I would like to keep the accessibility so the span is also a problem (and it break the design sometimes as well). I don’t use styled components either.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
A Complete Guide To props.children In React - codeburst
Essentially, props.children is a special prop, automatically passed to every component, that can be used to render the content included between the opening...
Read more >Composition vs Inheritance - React
React has a powerful composition model, and we recommend using composition instead of inheritance to reuse code between components. In this section, we...
Read more >Using Children in React - We Learn Code
Using Children in React. You can use props.children in React in order to access and utilize what you put inside the open and...
Read more >Component Children | Build with React JS
Children allow you to pass components as data to other components, just like any other prop you use. The special thing about children...
Read more >React Children And Iteration Methods - Smashing Magazine
In this article, we'll discuss and learn about the use case of iterating over React children and the ways to do it. In...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh ok I see, thank you for the explanation, this change is understandable then! Yes I meant a class component, I have just tried your solution and it work well!
Thank you for your help, and for this great library. 😃
I don’t like these solutions where you need to use forwardRef and make things complicated. So I’ve made a wrapper that gets the reference to your DOM element by sibling reference. Sharing it here:
The only thing you need to make sure is to have only one child component inside
<Tooltip>to make it work.