Installation
npx sse-hooks add use-intersection-observer
yarn dlx sse-hooks add use-intersection-observer
pnpm dlx sse-hooks add use-intersection-observer
deno run -A npm:sse-hooks add use-intersection-observer
bunx sse-hooks add use-intersection-observer
Usage
import { useIntersectionObserver } from "./{hooks file}";
// Example 1
const [ref, isIntersecting, entry] = useIntersectionObserver({
threshold: 0.5,
});
// Example 2
const { ref, isIntersecting, entry } = useIntersectionObserver({
threshold: 0.5,
});
API
Parameters
| Prop | Default | Type |
|---|---|---|
options |
|
The options for the Intersection Observer.
|
Returns
| Return Value | Default | Type |
|---|---|---|
return | - |
Hook return value |