React-tooltip: Momentary double render of Tooltip

Created on 1 Dec 2017  路  3Comments  路  Source: wwayne/react-tooltip

I see the Tooltip rendering momentarily in double, then reverting to proper single rendering automatically. This only happens sometimes, on certain components. In most other locations it works flawlessly.

Any suggestions? See attached

screen shot 2017-12-01 at 16 57 19 2

Most helpful comment

If your use case is the same as mine what is happening is:

  1. You added a Component with a ReactTooltip inside
  2. You are using that Component more than once.

Since the tooltip binds to the data-for attribute, its binding multiple tooltips to multiple triggers. Same thing happening to me.

A solution to this would be pretty cool. Like injecting a random hash to the data-for attribute or somehting.

All 3 comments

If your use case is the same as mine what is happening is:

  1. You added a Component with a ReactTooltip inside
  2. You are using that Component more than once.

Since the tooltip binds to the data-for attribute, its binding multiple tooltips to multiple triggers. Same thing happening to me.

A solution to this would be pretty cool. Like injecting a random hash to the data-for attribute or somehting.

Yes the issue was non-unique data-for attributes in large lists. Once I added unique values there this issue cleared up. Also the tooltips seem snappier now. Thanks!

BTW A solution I came up with is creating the component as a stateful component. Set a uniqueID in the state object and update it with a random value onComponentWillMount(), use that value for your data-for attribute. That way every instance of your component gets a different ID. Hope it helps!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanykim picture tanykim  路  4Comments

rothwelljeff picture rothwelljeff  路  3Comments

benbro picture benbro  路  3Comments

mmyoji picture mmyoji  路  4Comments

abijames picture abijames  路  3Comments