Import this in your client-side component
MyComponent.tsx
import { useElementVisibility } from "react-amazing-hooks";
API
Api | Description | Type | Return Type | Example |
---|---|---|---|---|
useElementVisibility | A hook to manage the visibility state of a specific element. | RefObject<Element>, number | boolean | const isVisible = useElementVisibility(myRef, 0.5); |
Check the 'Example' tab above the table for an exhaustive example.