{"id":20283162,"url":"https://github.com/bsonntag/react-use-intersection-observer","last_synced_at":"2025-10-19T17:33:05.034Z","repository":{"id":33212475,"uuid":"155127759","full_name":"bsonntag/react-use-intersection-observer","owner":"bsonntag","description":"React hook for using intersection observers.","archived":false,"fork":false,"pushed_at":"2023-10-27T12:12:46.000Z","size":452,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T05:51:17.705Z","etag":null,"topics":["hook","intersection-observer","react","react-hooks"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsonntag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-29T00:01:38.000Z","updated_at":"2023-08-22T07:50:04.000Z","dependencies_parsed_at":"2023-01-14T23:56:03.586Z","dependency_job_id":null,"html_url":"https://github.com/bsonntag/react-use-intersection-observer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsonntag%2Freact-use-intersection-observer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsonntag%2Freact-use-intersection-observer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsonntag%2Freact-use-intersection-observer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsonntag%2Freact-use-intersection-observer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsonntag","download_url":"https://codeload.github.com/bsonntag/react-use-intersection-observer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248360930,"owners_count":21090783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hook","intersection-observer","react","react-hooks"],"created_at":"2024-11-14T14:13:30.153Z","updated_at":"2025-10-19T17:32:59.963Z","avatar_url":"https://github.com/bsonntag.png","language":"JavaScript","readme":"# react-use-intersection-observer\n\nReact hook for using intersection observers.\n\n## Installation\n\nUsing npm:\n\n```sh\n$ npm install --save react-use-intersection-observer\n```\n\nUsing yarn:\n\n```sh\n$ yarn add react-use-intersection-observer\n```\n\nSince this module uses [React Hooks](https://reactjs.org/docs/hooks-intro.html),\nto use this module you'll need to install at least version `16.8.0`\nof `react` and `react-dom`:\n\n```sh\n$ yarn add react@^16.8.0 react-dom@^16.8.0\n```\n\n## Usage\n\n```js\nimport React, { useRef } from 'react';\nimport useIntersectionObserver from 'react-use-intersection-observer';\n\nfunction Example() {\n  const ref = useRef();\n  const [intersection] = useIntersectionObserver(ref);\n\n  const style = {\n    background: intersection \u0026\u0026 intersection.isIntersecting ? 'red' : 'blue',\n    height: 50,\n    width: 50\n  };\n\n  return \u003cdiv style={style} /\u003e;\n}\n```\n\n## API\n\n```js\nuseIntersectionObserver(Ref, ?Object): Array\u003cIntersectionObserverEntry\u003e\n```\n\nReceives a ref and an optional object and returns a list of\n[intersections](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver)\nreported by an [`IntersectionObserver`](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver).\n\n## Contributing\n\nPlease feel free to submit any issues or pull requests.\n\n## License\n\nMIT\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsonntag%2Freact-use-intersection-observer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsonntag%2Freact-use-intersection-observer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsonntag%2Freact-use-intersection-observer/lists"}