imbhargav5 / rooks

Essential React custom hooks ⚓ to super charge your components!
https://rooks.vercel.app
MIT License
3.2k stars 215 forks source link

feat: added a hook to handle Infinite Scroll #1757

Closed soumyajitmohapatra closed 4 weeks ago

soumyajitmohapatra commented 3 months ago

I've developed a new custom React hook, useInfiniteScroll, designed to handle infinite scrolling functionality seamlessly. This hook automatically fetches additional data as the user scrolls to the bottom of the page while managing states for loading, errors, and pagination.

Features Data Fetching: Automatically triggers data fetching when the user scrolls to the bottom of the page, ensuring continuous content loading. State Management: Efficiently manages the current page, accumulates fetched data, and handles loading and error states to provide a smooth user experience. Intersection Observer: Utilizes the useIntersectionObserverRef hook to detect when the target element comes into view and initiates data fetching accordingly.

Sandbox : preview

codesandbox[bot] commented 3 months ago

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

vercel[bot] commented 3 months ago

@soumyajitmohapatra is attempting to deploy a commit to the Rooks Team on Vercel.

A member of the Team first needs to authorize it.

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.