{"_id":"use-simple-infinite-scroll","_rev":"77-82afefa98652bf07dee64f1714707278","name":"use-simple-infinite-scroll","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"use-simple-infinite-scroll","version":"1.0.0","description":"A simple React Hook for infinite scrolling built on the Intersection Observer API","main":"dist/index.js","module":"dist/index.esm.js","umd:main":"dist/index.umd.production.min.js","unpkg":"dist/index.umd.production.min.js","jsdelivr":"dist/index.umd.production.min.js","jsnext:main":"dist/index.esm.js","source":"src/index.ts","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"npm run clean && rollup -c","clean":"rimraf dist","lint":"eslint '**/*.{js,ts}'","lint:fix":"npm run lint -- --fix","lint:types":"tsc --noEmit","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate","release":"semantic-release","commit":"commit"},"keywords":["react","hooks","react-hooks"],"repository":{"type":"git","url":"git+https://github.com/kotarella1110/use-simple-infinite-scroll.git"},"author":{"name":"Kotaro Sugawara","email":"kotarella1110@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/kotarella1110/use-simple-infinite-scroll/issues"},"homepage":"https://github.com/kotarella1110/use-simple-infinite-scroll#readme","devDependencies":{"@commitlint/cli":"^11.0.0","@commitlint/config-conventional":"^11.0.0","@commitlint/prompt-cli":"^11.0.0","@rollup/plugin-commonjs":"^15.1.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^9.0.0","@rollup/plugin-replace":"^2.3.3","@semantic-release/changelog":"^5.0.1","@semantic-release/git":"^9.0.0","@testing-library/react-hooks":"^3.4.2","@types/jest":"^26.0.14","@types/react":"^16.9.50","@typescript-eslint/eslint-plugin":"^2.34.0","all-contributors-cli":"^6.17.4","commitizen":"^4.2.1","cz-conventional-changelog":"^3.3.0","eslint":"^6.8.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.12.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.3","eslint-plugin-react-hooks":"^4.1.2","husky":"^4.3.0","jest":"^25.5.4","lint-staged":"^10.4.0","prettier":"^2.1.2","react":"^16.13.1","react-dom":"^16.13.1","react-intersection-observer":"^8.29.0","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","rollup":"^2.28.2","rollup-plugin-filesize":"^9.0.2","rollup-plugin-peer-deps-external":"^2.2.3","rollup-plugin-sourcemaps":"^0.6.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-typescript2":"^0.27.3","semantic-release":"^17.1.2","ts-jest":"^25.5.1","typescript":"^3.9.7"},"peerDependencies":{"react":"^16.8.0"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"npm run lint:types && lint-staged"}},"lint-staged":{"*.{js,ts}":["npm run lint:fix"],"*.{md,json,yml}":["prettier --write"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"4dad5492f91e9e43902969814ce303a2cfa8834d","_id":"use-simple-infinite-scroll@1.0.0","_nodeVersion":"12.18.4","_npmVersion":"6.14.8","dist":{"integrity":"sha512-6YfwQFJXuwbPwVeeIKPm8Plq7gIBYrLl+DP29WQqMRLTQ5GYPTjbvCJM3tt/xUaz8kB3FHrgs1KFZ0MQoKCYqw==","shasum":"5f294472c69a74f62f20c7e338b2e750598a7002","tarball":"https://registry.npmjs.org/use-simple-infinite-scroll/-/use-simple-infinite-scroll-1.0.0.tgz","fileCount":16,"unpackedSize":21302,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfeSp+CRA9TVsSAnZWagAAWdoP/iF0jLDDennA/7EZSsy4\nl6HnIddeqbMXKpFAHG3X0YpCbJeLR5+4TBdMPfyJ2xO8JsXrwOsm0MqXZRF/\njXGZIkEbExscquHOu1CaaIod5Z3HgxpiMKaqX5VcVjVdBzpvsCHLLW6v3lVi\nfxPRDVTZNlcUkHK9XpkbwIrxQYeOZeDYZMgbnVpsvhm83kHVUcNZBVKudZCw\nteuezuBKEv1zQtedjoO2Ao07I3HQ+fjRgBasFjIBhLyIAb3HGee7hs8559JZ\nNVtDK00a4MdXtJPaYoZsERyonxeclD2+aDQIO0cAglRIgK2VO2c7UB7VYfD6\nTEYJ8600uDyROYyU/FhxKTasPFKIFQBs3qIbXQnCPQfxxLUHbnjvhdqPZszG\nw/CHLBMtoLHqoUm7CcQzGKpd9Gh5NjvTw5ereLPFFfHJPlbEaDDhpJjqyE69\n3RZfeFbVsFTiiB5rEpVKpWXJfrNwp3lOIYndOVwrcf1IC01deqUn010zAMSd\nAkOsenlvwJFZ59q/hu75t4lJVg4xtxfQttT88gZSDZw8w+cVQ3fP+1xjRe5C\nwE7JUVDcqh7dlob+632Lko9pEyWpIiiQzwbt7r73ld0AiVPtLau2mbVE7LNY\nKMsUHUhEu1lgQNC9V0ZPTh3+KdGki8JGnBMcktO63HVG9NnUyYwjGV287WS1\nWVN4\r\n=5D8t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEeIUsodDgLmg3yC05hftnuPC6dQNJPkUXxwovJ8MnHfAiEA58FoDiMuAOhRvYP9/ytW/E3zw8FVx/9M/Zwpbpctasg="}]},"maintainers":[{"name":"kotarella1110","email":"kotarella1110@gmail.com"}],"_npmUser":{"name":"kotarella1110","email":"kotarella1110@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-simple-infinite-scroll_1.0.0_1601776253710_0.27600624687153474"},"_hasShrinkwrap":false},"1.0.1":{"name":"use-simple-infinite-scroll","version":"1.0.1","description":"A simple React Hook for infinite scrolling built on the Intersection Observer API","main":"dist/index.js","module":"dist/index.esm.js","umd:main":"dist/index.umd.production.min.js","unpkg":"dist/index.umd.production.min.js","jsdelivr":"dist/index.umd.production.min.js","jsnext:main":"dist/index.esm.js","source":"src/index.ts","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"npm run clean && rollup -c","clean":"rimraf dist","lint":"eslint '**/*.{js,ts,tsx}'","lint:fix":"npm run lint -- --fix","lint:types":"tsc --noEmit","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate","release":"semantic-release","commit":"commit"},"keywords":["react","hooks","react-hooks"],"repository":{"type":"git","url":"git+https://github.com/kotarella1110/use-simple-infinite-scroll.git"},"author":{"name":"Kotaro Sugawara","email":"kotarella1110@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/kotarella1110/use-simple-infinite-scroll/issues"},"homepage":"https://github.com/kotarella1110/use-simple-infinite-scroll#readme","devDependencies":{"@commitlint/cli":"^11.0.0","@commitlint/config-conventional":"^11.0.0","@commitlint/prompt-cli":"^11.0.0","@rollup/plugin-commonjs":"^15.1.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^9.0.0","@rollup/plugin-replace":"^2.3.3","@semantic-release/changelog":"^5.0.1","@semantic-release/git":"^9.0.0","@testing-library/react-hooks":"^3.4.2","@types/jest":"^26.0.14","@types/react":"^16.9.50","@typescript-eslint/eslint-plugin":"^2.34.0","all-contributors-cli":"^6.18.0","commitizen":"^4.2.1","cz-conventional-changelog":"^3.3.0","eslint":"^6.8.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.12.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jsx-a11y":"^6.3.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.3","eslint-plugin-react-hooks":"^4.1.2","husky":"^4.3.0","jest":"^25.5.4","lint-staged":"^10.4.0","prettier":"^2.1.2","react":"^16.13.1","react-dom":"^16.13.1","react-intersection-observer":"^8.29.0","react-test-renderer":"^16.13.1","rimraf":"^3.0.2","rollup":"^2.28.2","rollup-plugin-filesize":"^9.0.2","rollup-plugin-peer-deps-external":"^2.2.3","rollup-plugin-sourcemaps":"^0.6.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-typescript2":"^0.27.3","semantic-release":"^17.1.2","ts-jest":"^25.5.1","typescript":"^3.9.7"},"peerDependencies":{"react":"^16.8.0"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"npm run lint:types && lint-staged"}},"lint-staged":{"*.{js,ts}":["npm run lint:fix"],"*.{md,json,yml}":["prettier --write"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"77c80ef396fa89ee515c338a021e05787202ee39","_id":"use-simple-infinite-scroll@1.0.1","_nodeVersion":"12.18.4","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Ba+FKqyaMgzHGypZnLcxDOUrUXVPS4vRIvVRu96N3C4XuljgAuJjJ6iMT/jIuvKTxqS35blIDlN8QsI3Gb6Naw==","shasum":"cae8e55526a68abd09d101035f4f7eefcd0b29c7","tarball":"https://registry.npmjs.org/use-simple-infinite-scroll/-/use-simple-infinite-scroll-1.0.1.tgz","fileCount":16,"unpackedSize":23466,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfe0vECRA9TVsSAnZWagAAWeoQAKNElxK2UnGe7Ekn6pxG\nnWX44j2tAySgfYoDDUL7htwfumKpmzHMHLKRLpZy4KTtBeoYTDJ7IjkpY6pr\nc1GspOb3Vad6MeZ+9BZu4SamL1VGXU1jyLWHPJRoJqInyCP3MnyBeLouusRy\noGhh41huN10WEY212rbNez1tsvqLXn/acrKTNv5F+PPdwwKUCEEHqDg0Zv3A\n/G/5vC/Vr+vZCfYF3YJiEspz+Tl/FdLDjFwaEfVsr3/qKBdvFmyeIsNZUM0Z\nY/L98y/NmTKSgxn+qtLie6QrHIBrJIkJVu6zk4BJXHNetOyh+3D57Bu5HtTw\njvFFEVkV0N9a3ftVO+kabywFbzEsyAWagK71Zv9gCZ2WFPRnGlHDzP5qABDo\n+PjEMnTHH5WrNZ92o/0yg7IsyEvPhdwCIrVd3xmysXdxdsEpBYiA4JBqwyk0\ncYX5En2aHdO/KqVwUrQGTHx9AYNjolj62CrGo64+GavOlaY9JLXCjxzVkEHi\n6rlUmN8ggDJOk46G5/GreFBstSVKvdVkVIUmNwRjU3FR16lsj76ak1YNeXt7\nOdEn9IyjvUMpLxggWlrrr+Ta6aUt3wYBxJU5AK8PWqFZyicPJ+jMn0o2WBua\nwy1uNWdlNZnjERuYYZ/jJK4SEdfTM9uNYZHiXJKEmsBdnyigIbxgXCQ759JW\n+J+9\r\n=MrW8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/zRSgV+oqfx3txnz+1lPCd4R2Dx38NE90Ex9AWy8w7QIgEZhWChr93LNKNx0/9bYjMjHqTEO2VYdEfEKs4jyTk1M="}]},"maintainers":[{"name":"kotarella1110","email":"kotarella1110@gmail.com"}],"_npmUser":{"name":"kotarella1110","email":"kotarella1110@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-simple-infinite-scroll_1.0.1_1601915844415_0.3808390747994368"},"_hasShrinkwrap":false},"1.1.0":{"name":"use-simple-infinite-scroll","version":"1.1.0","description":"A simple React Hook for infinite scrolling built on the Intersection Observer API","main":"dist/index.js","module":"dist/index.esm.js","umd:main":"dist/index.umd.production.min.js","unpkg":"dist/index.umd.production.min.js","jsdelivr":"dist/index.umd.production.min.js","jsnext:main":"dist/index.esm.js","source":"src/index.ts","types":"dist/index.d.ts","sideEffects":false,"scripts":{"build":"npm run clean && rollup -c","clean":"rimraf dist","lint":"eslint '**/*.{js,ts,tsx}'","lint:fix":"npm run lint -- --fix","lint:types":"tsc --noEmit","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","contributors:add":"all-contributors add","contributors:generate":"all-contributors generate","release":"semantic-release","commit":"commit"},"keywords":["react","hooks","react-hooks"],"repository":{"type":"git","url":"git+https://github.com/kotarella1110/use-simple-infinite-scroll.git"},"author":{"name":"Kotaro Sugawara","email":"kotarella1110@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/kotarella1110/use-simple-infinite-scroll/issues"},"homepage":"https://github.com/kotarella1110/use-simple-infinite-scroll#readme","devDependencies":{"@commitlint/cli":"^11.0.0","@commitlint/config-conventional":"^11.0.0","@commitlint/prompt-cli":"^11.0.0","@rollup/plugin-commonjs":"^16.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^10.0.0","@rollup/plugin-replace":"^2.3.4","@semantic-release/changelog":"^5.0.1","@semantic-release/git":"^9.0.0","@testing-library/react-hooks":"^3.4.2","@types/jest":"^26.0.15","@types/react":"^17.0.0","@typescript-eslint/eslint-plugin":"^2.34.0","all-contributors-cli":"^6.19.0","commitizen":"^4.2.2","cz-conventional-changelog":"^3.3.0","eslint":"^6.8.0","eslint-config-airbnb-typescript":"^7.2.1","eslint-config-prettier":"^6.15.0","eslint-plugin-import":"^2.22.1","eslint-plugin-jsx-a11y":"^6.4.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react":"^7.21.5","eslint-plugin-react-hooks":"^4.2.0","husky":"^4.3.0","jest":"^25.5.4","lint-staged":"^10.5.2","prettier":"^2.2.0","react":"^16.14.0","react-dom":"^16.14.0","react-intersection-observer":"^8.31.0","react-test-renderer":"^16.14.0","rimraf":"^3.0.2","rollup":"^2.33.3","rollup-plugin-filesize":"^9.0.2","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-sourcemaps":"^0.6.3","rollup-plugin-terser":"^7.0.2","rollup-plugin-typescript2":"^0.29.0","semantic-release":"^17.3.0","ts-jest":"^25.5.1","typescript":"^3.9.7"},"peerDependencies":{"react":">=16.8.0 <=17.x"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"npm run lint:types && lint-staged"}},"lint-staged":{"*.{js,ts,tsx}":["npm run lint:fix"],"*.{md,json,yml}":["prettier --write"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"0cce4bff0a0ad3e36c7e5fecc6d8541f04f74e8c","_id":"use-simple-infinite-scroll@1.1.0","_nodeVersion":"12.19.0","_npmVersion":"6.14.9","dist":{"integrity":"sha512-z68O7rEMySRyhw38XVHyMRoVpVEXNFDOVwWcxXEU2B2lmXWfqhAddDQHMlvAJv3MSlb3Ni7dXg3N7APlYYsq9A==","shasum":"7d4ba56d5873e7d2ff1f645709862222be709e48","tarball":"https://registry.npmjs.org/use-simple-infinite-scroll/-/use-simple-infinite-scroll-1.1.0.tgz","fileCount":16,"unpackedSize":27527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwF5YCRA9TVsSAnZWagAA3LQP/R1LaOiATzKZty+3sVQg\nNuYPIIdyEJjQBlWXQgwVRgPpVI/OGILGThkPLUjx/aYPQNMOd6f0AcOS2q/r\nBLmDhGuge+YR4rYDhtN66C+phY8hHJfdl16vzBHXQotWGcF72ALUmOpewTKf\neinblR0ko+mvKXhOrT1KmEWcBM8T1gZnqJelqAfRfz1223hcELZUK6cgSe7P\n2r5Cvz5NG4M3uJFdvThFyNqEIYE9OPuqp2jB4So+S4VQB4L8/atKPEbxXTpv\nwioFllLV6r2v4OmkMJ/9QPEx8AlfFinl8CEOgUxE+mCRfy1+Jl2XS6k3/vqI\nTuUPICDZVV5Q8UnmTRYcVqnxbaJ678j0J+xMGFsVzSQrGd9/IDgmdDeF9REN\nYeIkF5yAETvGgfa5H/m4Y9FqGjroyCWrKru20Po9ylcBrehSBM+WeyOVVPt/\nHYwXE9dN4IuSkqsqwvAFtr80zePX6qf8ehDk6vsOE8AxcLR64nCNnlzo/+Xk\nuzm3hFyKMlfp4yVOqjxW5mToXMcsnNQhOUKZL57pNt0qLRPWtm8hT1EBTIrx\nd5LqBdMqcrtQV+NrKXGvkxJI/gx/DqKSZDjqsmVlB8fH7zyD9FgzRiKA1+In\nBaHYcsA4D0Fi6Rk52NzWR+26wtjxLzx6aJHc5PcApe7g648r95bmkLxTvJbm\nCZDG\r\n=ArTi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFlR34UN7fFd1Neg5iOfTU2Db89+oSQL86Ru35pzR1YXAiA7TGLHypdDYAWpGBbYHmDIxDTeeCa+Pjh6TKiJJMJEmg=="}]},"_npmUser":{"name":"kotarella1110","email":"kotarella1110@gmail.com"},"directories":{},"maintainers":[{"name":"kotarella1110","email":"kotarella1110@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-simple-infinite-scroll_1.1.0_1606442583937_0.8605152560636284"},"_hasShrinkwrap":false}},"time":{"created":"2020-10-04T01:50:53.710Z","1.0.0":"2020-10-04T01:50:53.822Z","modified":"2022-05-22T22:38:40.852Z","1.0.1":"2020-10-05T16:37:24.523Z","1.0.2":"2020-10-05T16:44:25.035Z","1.0.3":"2020-10-05T16:51:33.572Z","1.0.4":"2020-10-05T16:58:08.315Z","1.0.5":"2020-10-05T17:05:49.951Z","1.0.6":"2020-10-05T17:12:52.922Z","1.0.7":"2020-10-05T17:47:21.151Z","1.0.8":"2020-10-05T17:54:35.788Z","1.0.9":"2020-10-05T18:01:22.987Z","1.0.10":"2020-10-05T18:08:25.728Z","1.0.11":"2020-10-05T18:15:14.764Z","1.0.12":"2020-10-05T18:50:03.935Z","1.0.13":"2020-10-05T18:58:21.166Z","1.0.14":"2020-10-05T19:05:21.585Z","1.0.15":"2020-10-05T19:12:37.235Z","1.0.16":"2020-10-05T19:33:46.347Z","1.0.17":"2020-10-05T19:42:03.604Z","1.0.18":"2020-10-05T19:49:46.667Z","1.0.19":"2020-10-05T19:56:34.096Z","1.0.20":"2020-10-05T20:03:27.250Z","1.0.21":"2020-10-05T20:10:04.343Z","1.0.22":"2020-10-05T20:29:45.211Z","1.0.23":"2020-10-05T20:50:04.217Z","1.0.24":"2020-10-05T20:56:59.797Z","1.0.25":"2020-10-05T21:04:08.680Z","1.0.26":"2020-10-05T21:11:26.395Z","1.0.27":"2020-10-05T21:24:38.924Z","1.0.28":"2020-10-05T21:32:07.389Z","1.0.29":"2020-10-05T21:39:28.683Z","1.0.30":"2020-10-05T21:48:59.148Z","1.0.31":"2020-10-05T21:56:22.661Z","1.0.32":"2020-10-05T22:03:50.745Z","1.0.33":"2020-10-05T22:10:30.053Z","1.0.34":"2020-10-05T22:27:12.749Z","1.0.35":"2020-10-05T22:34:07.922Z","1.0.36":"2020-10-05T22:40:49.811Z","1.0.37":"2020-10-05T22:47:31.013Z","1.0.38":"2020-10-05T22:54:26.833Z","1.1.0":"2020-11-27T02:03:04.053Z"},"maintainers":[{"name":"kotarella1110","email":"kotarella1110@gmail.com"}],"description":"A simple React Hook for infinite scrolling built on the Intersection Observer API","homepage":"https://github.com/kotarella1110/use-simple-infinite-scroll#readme","keywords":["react","hooks","react-hooks"],"repository":{"type":"git","url":"git+https://github.com/kotarella1110/use-simple-infinite-scroll.git"},"author":{"name":"Kotaro Sugawara","email":"kotarella1110@gmail.com"},"bugs":{"url":"https://github.com/kotarella1110/use-simple-infinite-scroll/issues"},"license":"MIT","readme":"<div align=\"center\">\n\n<h1>use-simple-infinite-scroll</h1>\n\n<h3>A simple React Hook for infinite scrolling built on the Intersection Observer API</h3>\n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE)\n[![Actions Status](https://github.com/kotarella1110/use-simple-infinite-scroll/workflows/Release/badge.svg)](https://github.com/kotarella1110/use-simple-infinite-scroll/actions?query=workflow%3ARelease)\n[![NPM Version](https://img.shields.io/npm/v/use-simple-infinite-scroll?style=flat-square)](https://www.npmjs.com/package/use-simple-infinite-scroll)\n[![Downloads Month](https://img.shields.io/npm/dm/use-simple-infinite-scroll?style=flat-square)](https://www.npmjs.com/package/use-simple-infinite-scroll)\n[![Downloads Total](https://img.shields.io/npm/dt/use-simple-infinite-scroll?style=flat-square)](https://www.npmjs.com/package/use-simple-infinite-scroll)\n[![Dependencies Status](https://david-dm.org/kotarella1110/use-simple-infinite-scroll.svg?style=flat-square)](https://david-dm.org/kotarella1110/use-simple-infinite-scroll)\n[![Semantic Release](https://img.shields.io/badge/%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square)](CONTRIBUTING.md)\n\n<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)\n\n<!-- ALL-CONTRIBUTORS-BADGE:END -->\n\n</div>\n\n## Installation\n\n```sh\nnpm install use-simple-infinite-scroll\n```\n\n## Usage\n\n[![Edit kotarella1110/use-simple-infinite-scroll: example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/kotarella1110/use-simple-infinite-scroll/tree/master/example?fontsize=14&hidenavigation=1&theme=dark)\n\n### Basic\n\n```tsx\nimport React, { useState } from 'react';\nimport { useSimpleInfiniteScroll } from 'use-simple-infinite-scroll';\n\ntype Item = {\n  id: number;\n  name: string;\n};\n\ntype Result = {\n  data: Item[];\n  nextCursor: number | null;\n};\n\nconst canFetchMore = (nextCursor: Result['nextCursor']) => nextCursor !== null;\n\nconst InfiniteScrollExample = () => {\n  const [isLoading, setIsLoading] = useState(false);\n  const [items, setItems] = useState<Item[]>([]);\n  const [nextCursor, setNextCursor] = useState<Result['nextCursor']>(0);\n\n  const fetchMore = () => {\n    setIsLoading(true);\n    fetch(`/api/items?cursor=${nextCursor}`)\n      .then((res) => res.json())\n      .then((res: Result) => {\n        setItems([...items, ...res.data]);\n        setNextCursor(res.nextCursor);\n        setIsLoading(false);\n      });\n  };\n\n  const [targetRef] = useSimpleInfiniteScroll({\n    onLoadMore: fetchMore,\n    canLoadMore: canFetchMore(nextCursor),\n  });\n\n  return (\n    <>\n      {items.length !== 0 ? (\n        <ul>\n          {items.map((item) => (\n            <li key={item.id}>{item.name}</li>\n          ))}\n        </ul>\n      ) : null}\n      <div ref={targetRef}>\n        {isLoading\n          ? 'Loading more...'\n          : canFetchMore(nextCursor)\n          ? 'Load More'\n          : 'Nothing more to load'}\n      </div>\n    </>\n  );\n};\n```\n\n### React Query\n\n```tsx\nimport React from 'react';\nimport { useInfiniteQuery } from 'react-query';\nimport { useSimpleInfiniteScroll } from 'use-simple-infinite-scroll';\n\ntype Item = {\n  id: number;\n  name: string;\n};\n\ntype Result = {\n  data: Item[];\n  nextCursor: number | null;\n};\n\nconst InfiniteScrollExample = () => {\n  const {\n    status,\n    data,\n    error,\n    isFetching,\n    isFetchingMore,\n    fetchMore,\n    canFetchMore,\n  } = useInfiniteQuery<Result, Error>(\n    'items',\n    (key: string, cursor = 0) =>\n      fetch(`/api/items?cursor=${cursor}`).then((res) => res.json()),\n    {\n      getFetchMore: (lastGroup) => lastGroup.nextCursor,\n    },\n  );\n\n  const [targetRef, rootRef] = useSimpleInfiniteScroll({\n    onLoadMore: fetchMore,\n    canLoadMore: !!canFetchMore,\n  });\n\n  return status === 'loading' ? (\n    <p>Loading...</p>\n  ) : status === 'error' ? (\n    <span>Error: {error && error.message}</span>\n  ) : (\n    <div\n      style={{\n        overflow: 'auto',\n      }}\n      ref={rootRef}\n    >\n      <ul>\n        {data &&\n          data.map((page, i) => (\n            <React.Fragment key={i}>\n              {page.data.map((item) => (\n                <li key={itme.id}>{item.name}</li>\n              ))}\n            </React.Fragment>\n          ))}\n      </ul>\n      <div>\n        <button\n          type=\"button\"\n          ref={targetRef}\n          onClick={() => fetchMore()}\n          disabled={!canFetchMore || !!isFetchingMore}\n        >\n          {isFetchingMore\n            ? 'Loading more...'\n            : canFetchMore\n            ? 'Load More'\n            : 'Nothing more to load'}\n        </button>\n      </div>\n      <div>\n        {isFetching && !isFetchingMore ? 'Background Updating...' : null}\n      </div>\n    </div>\n  );\n};\n```\n\n## API\n\n```ts\nconst useSimpleInfiniteScroll: (options: {\n  canLoadMore: boolean;\n  onLoadMore: () => void;\n  rootMargin?: string;\n  threshold?: number | number[];\n}) => [(target: Element | null) => void, (root: Element | null) => void];\n```\n\n| Name          | Type                 | Default | Required | Descripttion                                                                                                                                           |\n| :------------ | :------------------- | :------ | :------: | :----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `canLoadMore` | `boolean`            |         |    ✓     | Specifies if there are more entities to load.                                                                                                          |\n| `onLoadMore`  | `() => void`         |         |    ✓     | Called when the user has scrolled all the way to the end.                                                                                              |\n| `rootMargin`  | `string`             | `\"0px\"` |          | Margin around the root. Can have values similar to the CSS margin property, e.g. `\"10px 20px 30px 40px\"` (top, right, bottom, left).                   |\n| `threshold`   | `number \\| number[]` | `0`     |          | Either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. |\n\nFor more information on `rootMargin` and `threshold` option, visit the [MDN web docs](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).\n\n## FAQ\n\n### How can I assign multiple refs to a component?\n\nYou can wrap multiple `ref` assignments in a single `useCallback`:\n\n```tsx\nimport React, { useRef, useCallback } from 'react';\nimport { useSimpleInfiniteScroll } from 'use-simple-infinite-scroll';\n\nconst AssignMultipleRefsExample = () => {\n  const rootRef = useRef<HTMLDivElement | null>();\n  const targetRef = useRef<HTMLDivElement | null>();\n\n  const [setTargetRef, setRootRef] = useSimpleInfiniteScroll({\n    onLoadMore: () => {},\n    canLoadMore: true,\n  });\n\n  // Use `useCallback` so we don't recreate the function on each render - Otherwise, the function passed to `onLoadMore` option will be called twice\n  const setRootRefs = useCallback(\n    (node: HTMLDivElement | null) => {\n      // Ref's from useRef needs to have the node assigned to `current`\n      rootRef.current = node;\n      // Callback refs, like the one from `useSimpleInfiniteScroll`, is a function that takes the node as an argument\n      setRootRef(node);\n    },\n    [setRootRef],\n  );\n\n  const setTargetRefs = useCallback(\n    (node: HTMLDivElement | null) => {\n      targetRef.current = node;\n      setTargetRef(node);\n    },\n    [setTargetRef],\n  );\n\n  return (\n    <div ref={setRootRefs}>\n      <div ref={setTargetRefs} />\n    </div>\n  );\n};\n```\n\n### Which browsers are supported?\n\nuse-simple-infinite-scroll supports all of the major modern browsers.\nBrowsers like IE11 are not supported: if you need to support older browsers you can add [IntersectionObserver polyfill](https://www.npmjs.com/package/intersection-observer).\n\nYou can install the polyfill via npm or by downloading a [zip](https://github.com/w3c/IntersectionObserver/archive/gh-pages.zip) of this repository:\n\n```sh\nnpm install intersection-observer\n```\n\nThen import it in your app:\n\n```js\nimport 'intersection-observer';\n```\n\n## Contributing\n\nContributions are always welcome! Please read the [contributing](./CONTRIBUTING.md) first.\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://qiita.com/kotarella1110\"><img src=\"https://avatars1.githubusercontent.com/u/12913947?v=4?s=100\" width=\"100px;\" alt=\"\"/><br /><sub><b>Kotaro Sugawara</b></sub></a><br /><a href=\"https://github.com/kotarella1110/use-simple-infinite-scroll/commits?author=kotarella1110\" title=\"Code\">💻</a> <a href=\"https://github.com/kotarella1110/use-simple-infinite-scroll/commits?author=kotarella1110\" title=\"Documentation\">📖</a> <a href=\"#ideas-kotarella1110\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"#infra-kotarella1110\" title=\"Infrastructure (Hosting, Build-Tools, etc)\">🚇</a> <a href=\"https://github.com/kotarella1110/use-simple-infinite-scroll/commits?author=kotarella1110\" title=\"Tests\">⚠️</a></td>\n  </tr>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n## License\n\n[MIT](./LICENSE) © [Kotaro Sugawara](https://twitter.com/kotarella1110)\n","readmeFilename":"README.md"}