{"_id":"@bongsik/infinite-scroll","name":"@bongsik/infinite-scroll","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bongsik/infinite-scroll","version":"0.1.0","description":"React hook for infinite scroll functionality","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","lint":"eslint src","type-check":"tsc --noEmit"},"keywords":["react","infinite-scroll","scroll","hook","typescript"],"author":{"name":"parkjungyuxx"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/parkjungyuxx/off-the-pitch.git","directory":"packages/infinite-scroll"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"devDependencies":{"@types/react":"^19","@types/react-dom":"^19","eslint":"^8.57.0","react":"^19.2.0","react-dom":"^19.2.0","tsup":"^8.0.0","typescript":"^5"},"_id":"@bongsik/infinite-scroll@0.1.0","gitHead":"734f5be7659fbabc9822cbc1d66487f6772eb21a","bugs":{"url":"https://github.com/parkjungyuxx/off-the-pitch/issues"},"homepage":"https://github.com/parkjungyuxx/off-the-pitch#readme","_nodeVersion":"23.6.1","_npmVersion":"11.4.1","dist":{"integrity":"sha512-4lwLFDIMLlQeWeW5zWR2SV9Zrj5hdAaEzVHsGNHw+09cPHdxUmdlt2ES5NClCR+wdy5tbQAp56m7y3MNSji57Q==","shasum":"38127aebcd010c52dee83a5217d566ef6a9534fa","tarball":"https://registry.npmjs.org/@bongsik/infinite-scroll/-/infinite-scroll-0.1.0.tgz","fileCount":8,"unpackedSize":18837,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC1Jm2hN33qz654KYKd4l++u8Bj891ZZv74OBMA7v3hFQIhAOnvy51vqMYJmT8orqvihU0DZW4y8WAUenlGgPy53gVs"}]},"_npmUser":{"name":"parkjungyu","email":"parkjungyu09@gmail.com"},"directories":{},"maintainers":[{"name":"parkjungyu","email":"parkjungyu09@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/infinite-scroll_0.1.0_1763990273869_0.27658917689294116"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-24T13:17:53.761Z","0.1.0":"2025-11-24T13:17:54.106Z","modified":"2025-11-24T13:17:54.509Z"},"maintainers":[{"name":"parkjungyu","email":"parkjungyu09@gmail.com"}],"description":"React hook for infinite scroll functionality","homepage":"https://github.com/parkjungyuxx/off-the-pitch#readme","keywords":["react","infinite-scroll","scroll","hook","typescript"],"repository":{"type":"git","url":"git+https://github.com/parkjungyuxx/off-the-pitch.git","directory":"packages/infinite-scroll"},"author":{"name":"parkjungyuxx"},"bugs":{"url":"https://github.com/parkjungyuxx/off-the-pitch/issues"},"license":"MIT","readme":"# @bongsik/infinite-scroll\n\nReact hook for infinite scroll functionality using Intersection Observer API.\n\n## Installation\n\n```bash\nnpm install @bongsik/infinite-scroll\n# or\npnpm add @bongsik/infinite-scroll\n# or\nyarn add @bongsik/infinite-scroll\n```\n\n## Usage\n\n```tsx\nimport { useInfiniteScroll } from \"@bongsik/infinite-scroll\";\n\nfunction MyComponent() {\n  const [items, setItems] = useState([]);\n  const [hasMore, setHasMore] = useState(true);\n  const [isLoading, setIsLoading] = useState(false);\n\n  const fetchMore = async () => {\n    setIsLoading(true);\n    // Fetch next page\n    const newItems = await fetchNextPage();\n    setItems((prev) => [...prev, ...newItems]);\n    setHasMore(newItems.length > 0);\n    setIsLoading(false);\n  };\n\n  const { sentinelRef } = useInfiniteScroll({\n    loadMore: fetchMore,\n    hasMore,\n    isLoading,\n    threshold: 100, // Load when 100px before reaching the bottom\n  });\n\n  return (\n    <div>\n      {items.map((item) => (\n        <div key={item.id}>{item.content}</div>\n      ))}\n      {hasMore && <div ref={sentinelRef}>Loading...</div>}\n    </div>\n  );\n}\n```\n\n## API\n\n### `useInfiniteScroll(options)`\n\n#### Options\n\n| Property | Type | Default | Description |\n|----------|------|---------|-------------|\n| `loadMore` | `() => void \\| Promise<void>` | **required** | Function to load next page |\n| `hasMore` | `boolean` | `false` | Whether there is more data to load |\n| `isLoading` | `boolean` | `false` | Whether currently loading |\n| `threshold` | `number` | `100` | Distance in pixels before triggering load |\n| `direction` | `\"up\" \\| \"down\"` | `\"down\"` | Scroll direction |\n| `root` | `HTMLElement \\| null` | `null` | Scroll container element |\n| `rootMargin` | `string` | `\"0px\"` | Root margin for Intersection Observer |\n\n#### Returns\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `sentinelRef` | `RefObject<HTMLDivElement>` | Ref to attach to sentinel element |\n| `loadMore` | `() => void` | Manual function to load more |\n\n## License\n\nMIT\n\n","readmeFilename":"README.md","_rev":"1-c920bf4dc50581f2d54fb8d0dd57f913"}