React-tooltip: Tooltip not shown sometimes

Created on 13 Jul 2016  路  4Comments  路  Source: wwayne/react-tooltip

When there is a element that using a variable for content of tooltip and the variable is null first, then the tooltip will not shown, for example below.

render() {
  let disabled = this.whatEveryFunction();
  let tip = disabled ? 'Show something' : null;
  return (
    <div>
      <p data-tip="always show something"></p>
      <button data-tip={tip}>Save</button>
      <ReactTooltip />
    </div>
  )
}

Most helpful comment

@donilan you can also call ReactTooltip.rebuild() to re-bind tooltips. I'm using this in a componentDidUpdate hook to re-bind tooltips as data changes.

All 4 comments

It will works if I change null to empty string, is it a bug or something?

@donilan that's because the tooltip only accept String

@donilan you can also call ReactTooltip.rebuild() to re-bind tooltips. I'm using this in a componentDidUpdate hook to re-bind tooltips as data changes.

@asidiali is Correct Snippet

    useEffect(() => {
        ReactTooltip.rebuild()
    });

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanykim picture tanykim  路  4Comments

kristinadarroch picture kristinadarroch  路  3Comments

Joseppi83 picture Joseppi83  路  4Comments

abijames picture abijames  路  3Comments

mmyoji picture mmyoji  路  4Comments