Skip to content

Commit 2dc76e7

Browse files
committed
2 parents 68fc537 + 400bd60 commit 2dc76e7

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
- [Intro](#react-tiny-popover)
2+
- [Installation](#install)
3+
- [Demo](#demo)
4+
- [Migrating from versions 3 and 4](#migrating-from-versions-3-and-4)
5+
- [Examples](#examples)
6+
- [API](#api)
7+
18
# react-tiny-popover
29

310
A lightweight, highly customizable, and non-intrusive popover react HOC with no other dependencies! <b>Typescript friendly</b>, as well!
@@ -26,6 +33,40 @@ npm install react-tiny-popover --save
2633

2734
:+1:
2835

36+
## Migrating from versions 3 and 4
37+
38+
`react-tiny-popover 5.x.x` has abandoned use of `findDOMNode` to gain a reference to `Popover`'s target DOM node, and now explicitly relies on a ref. Since React has deprecated `findDOMNode` in `StrictMode`, now seems like an appropriate time to shift away from this under-the-hood logic toward a clearer and more declarative API.
39+
40+
If your code looked this way:
41+
42+
```JSX
43+
<Popover
44+
isOpen={isPopoverOpen}
45+
content={<div>Hi! I'm popover content.</div>}
46+
>
47+
<div onClick={() => setIsPopoverOpen(!isPopoverOpen)}>
48+
Click me!
49+
</div>
50+
</Popover>;
51+
```
52+
53+
...it will now look this way:
54+
55+
```JSX
56+
<Popover
57+
isOpen={isPopoverOpen}
58+
content={<div>Hi! I'm popover content.</div>}
59+
>
60+
{ref => (
61+
<div ref={ref} onClick={() => setIsPopoverOpen(!isPopoverOpen)}>
62+
Click me!
63+
</div>
64+
)}
65+
</Popover>;
66+
```
67+
68+
See more examples below!
69+
2970
## Examples
3071

3172
```JSX
@@ -66,7 +107,7 @@ import Popover from 'react-tiny-popover'
66107
)}
67108
>
68109
{ref => (
69-
<div onClick={() => setIsPopoverOpen(!isPopoverOpen)}>Click me!</div>
110+
<div ref={ref} onClick={() => setIsPopoverOpen(!isPopoverOpen)}>Click me!</div>
70111
)}
71112
</Popover>;
72113
```

0 commit comments

Comments
 (0)