Skip to content

Commit d53942a

Browse files
committed
docs(README.md): replace deprecated findDOMNode with callback ref example
1 parent 795f534 commit d53942a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ Check the example [React-tooltip Test](https://react-tooltip.netlify.com/)
9797
> Hide the tooltip manually, the target is optional, if no target passed in, all existing tooltips will be hidden
9898
9999
```js
100-
import {findDOMNode} from 'react-dom'
101100
import ReactTooltip from 'react-tooltip'
102101

103-
<p ref='foo' data-tip='tooltip'></p>
104-
<button onClick={() => { ReactTooltip.hide(findDOMNode(this.refs.foo)) }}></button>
102+
<p ref={ref => this.fooRef = ref} data-tip='tooltip'></p>
103+
<button onClick={() => { ReactTooltip.hide(this.fooRef) }}></button>
105104
<ReactTooltip />
106105
```
107106

@@ -114,11 +113,10 @@ import ReactTooltip from 'react-tooltip'
114113
> Show specific tooltip manually, for example:
115114
116115
```js
117-
import {findDOMNode} from 'react-dom'
118116
import ReactTooltip from 'react-tooltip'
119117

120-
<p ref='foo' data-tip='tooltip'></p>
121-
<button onClick={() => { ReactTooltip.show(findDOMNode(this.refs.foo)) }}></button>
118+
<p ref={ref => this.fooRef = ref} data-tip='tooltip'></p>
119+
<button onClick={() => { ReactTooltip.show(this.fooRef) }}></button>
122120
<ReactTooltip />
123121
```
124122

0 commit comments

Comments
 (0)