useInfiniteScroll ​
Hook that defines the logic for infinite scroll
typescript
import { useInfiniteScroll } from '@siberiacancode/reactuse';
Usage ​
typescript
const { ref, isLoading } = useInfiniteScroll(() => console.log('infinite scroll'));
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
callback | (event: Event) => void | - | The callback to execute when a click outside the target is detected |
options.distance? | number | 10 | The distance in pixels to trigger the callback |
options.direction? | string | 'bottom' | The direction to trigger the callback |
Parameters
Name | Type | Default | Note |
---|---|---|---|
target | Target | - | The target element to detect infinite scroll for |
callback | (event: Event) => void | - | The callback to execute when a click outside the target is detected |
options.distance? | number | 10 | The distance in pixels to trigger the callback |
options.direction? | string | 'bottom' | The direction to trigger the callback |
Returns
boolean