Update formatting
This commit is contained in:
@ -7,7 +7,7 @@ firstSeen: 2021-09-10T05:00:00-04:00
|
||||
Observes visibility changes for a given element.
|
||||
|
||||
- Use the `useState()` hook to store the intersection value of the given element.
|
||||
- Create an `IntersectionObserver()` with the given `options` and an appropriate callback to update the `isIntersecting` state variable.
|
||||
- Create an `IntersectionObserver` with the given `options` and an appropriate callback to update the `isIntersecting` state variable.
|
||||
- Use the `useEffect()` hook to call `IntersectionObserver.observe()` when mounting the component and clean up using `IntersectionObserver.unobserve()` when unmounting.
|
||||
|
||||
```jsx
|
||||
|
||||
Reference in New Issue
Block a user