We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12a9065 commit 75f9f28Copy full SHA for 75f9f28
README.md
@@ -75,14 +75,13 @@ const Component = () => {
75
76
```js
77
const inViewRef = useOnInView(
78
- (enterEntry) => {
79
- // Do something with the element that came into view
80
- console.log('Element is in view', enterEntry?.target);
81
-
82
- // Optionally return a cleanup function
83
- return (exitEntry) => {
84
- console.log('Element moved out of view or unmounted');
85
- };
+ (inView, entry) => {
+ if (inView) {
+ // Do something with the element that came into view
+ console.log("Element is in view", entry.target);
+ } else {
+ console.log("Element left view", entry.target);
+ }
86
},
87
options // Optional IntersectionObserver options
88
);
0 commit comments