You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**as**|`string`|`'div'`| Render the wrapping element as this element. Defaults to `div`. |
171
171
|**children**|`({ref, inView, entry}) => ReactNode` or `ReactNode`|`undefined`| Children expects a function that receives an object containing the `inView` boolean and a `ref` that should be assigned to the element root. Alternatively pass a plain child, to have the `<InView />` deal with the wrapping element. You will also get the `IntersectionObserverEntry` as `entry`, giving you more details. |
172
172
173
173
### Intersection Observer v2 🧪
@@ -218,9 +218,9 @@ import { useInView } from 'react-intersection-observer';
218
218
219
219
functionComponent(props) {
220
220
constref=useRef();
221
-
const[inViewRef, inView]=useInView();
221
+
const{ ref:inViewRef, inView }=useInView();
222
222
223
-
// Use `useCallback` so we don't recreate the function on each render - Could result in infinite loop
223
+
// Use `useCallback` so we don't recreate the function on each render
224
224
constsetRefs=useCallback(
225
225
(node) => {
226
226
// Ref's from useRef needs to have the node assigned to `current`
0 commit comments