behavior I don't understand, is this a quirk of react or react-tooltip?
See original GitHub issueIf I put
<ReactTooltip />
in a ‘high level’ component and put
<p data-tip="hello world">Tooltip</p>
nested about 3 components down then tooltips don’t show. However, if I put a
<p data-tip="hello world">Tooltip</p>
half way between them the lower level tooltips work, but only if I mouse over the mid level tooltip first.
If I put
<ReactTooltip />
in the ‘middle’ then tooltips from all nested levels work.
If I browse through the DOM I can see all the nodes in the right places, it just seems like the ReactTooltip javascript event isn’t setting up or it can’t see the tooltip node at a distance.
Issue Analytics
- State:
- Created 8 years ago
- Comments:22 (6 by maintainers)
Top Results From Across the Web
behavior I don't understand, is this a quirk of react or ... - GitHub
I happened to use Redux and react-tooltip in my recent project, I put <ReactTooltip /> in the smart component and use it in...
Read more >react-tooltip - npm
The component was designed to set <ReactTooltip /> once and then use tooltip everywhere, but a lot of people get stuck when using...
Read more >The Little React Quirk I Wish I'd Known Sooner
Knowing the internals is probably not necessary to build React apps but by understanding the underlying concepts, you should be able to write...
Read more >React tooltip, dont show beside the element - Stack Overflow
The tooltip is supposed to know where to appear based on the element it is for (the <a> in the <li> element in...
Read more >React Tooltip component - Material UI - MUI
They don't have directional arrows; instead, they rely on motion ... You can use the open , onOpen and onClose props to control...
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
I only ever put
<ReactTooltip />
in one place, which makes sense to me. I only import it in that same file. But in order for the tooltips to work, I have to<p data-tip="hello world">Tooltip</p>
either in the same component or a component close to it (maybe it has to be on the same ‘side’ of the smart component, I’m not sure). Once I put<p data-tip="hello world">Tooltip</p>
In a component ‘close’ to where its required, the tooltips everywhere start working.I can confirm that putting
ReactTooltip.rebuild()
in componentDidMount (and reloading page) does NOT work, but in componentDidUpdate DOES work.This is not such a problem for me, I thought I’d just point out this strange behavior. I’m not sure how smart components in redux work but it looks like some voodoo is going on there and it might be interfering with react-tooltips, or it might have nothing to do with it, but thats all I can think of.
Good looking tooltips btw 👍
If I’m not misunderstand, the code structure you said is as follows:
If so, on my test, this works good. So I suppose you mount the lower level component after triggering some actions?
There is a
ReactTooltip.rebuild()
function to ‘re-bind’ tooltip, so I think you can take a try byLet me know if I misunderstand your problem.