{"id":15801449,"url":"https://github.com/scriptedalchemy/intersection-observer-hooks","last_synced_at":"2025-04-01T14:32:20.669Z","repository":{"id":35111955,"uuid":"208146689","full_name":"ScriptedAlchemy/intersection-observer-hooks","owner":"ScriptedAlchemy","description":"React hooks for intersection observer","archived":false,"fork":false,"pushed_at":"2023-12-15T14:57:34.000Z","size":170,"stargazers_count":4,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-06T01:22:26.180Z","etag":null,"topics":[],"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/ScriptedAlchemy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-12T21:07:49.000Z","updated_at":"2023-09-02T15:39:40.000Z","dependencies_parsed_at":"2023-12-15T15:52:46.935Z","dependency_job_id":"827b5447-43c8-49ff-b21a-bbc7cf6a3294","html_url":"https://github.com/ScriptedAlchemy/intersection-observer-hooks","commit_stats":{"total_commits":6,"total_committers":4,"mean_commits":1.5,"dds":0.5,"last_synced_commit":"37c5e7993a3cad9ce7cf8248cb97f5ea4620555d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScriptedAlchemy%2Fintersection-observer-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScriptedAlchemy%2Fintersection-observer-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScriptedAlchemy%2Fintersection-observer-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ScriptedAlchemy%2Fintersection-observer-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ScriptedAlchemy","download_url":"https://codeload.github.com/ScriptedAlchemy/intersection-observer-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604613,"owners_count":20804100,"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":[],"created_at":"2024-10-05T01:22:36.305Z","updated_at":"2025-04-01T14:32:20.404Z","avatar_url":"https://github.com/ScriptedAlchemy.png","language":"JavaScript","readme":"\n\n\n`import {useIntersectionObserver, addTrackedLoader} from \"intersection-observer-hooks\"`\n\nAPI:\n\n`useIntersectionObserver(callback, nodeRef, options = {}) `\n\n`callback`: returns a bool of when isIntersecting\n\n`options`: Object \u003cbr\u003e\n`options.once`: observe once then unobserve\n`options.rootMargin`: the root margin for intersection observer\n`options.rootRef`: React ref\n\nExample use:\n\n```js\nimport {useIntersectionObserver, addTrackedLoader} from \"intersection-observer-hooks\"\n\n  useIntersectionObserver((visible) =\u003e {\n    // then we are not at SSR\n    ssr.current = false;\n    setOffscreen(!visible);\n    onVisibilitySet(visible);\n  }, containerRef || ref, {\n    once: true,\n    rootMargin: '30%',\n    rootRef,\n  });\n\n\n  useEffect(() =\u003e {\n    if (eager) {\n      return addTrackedLoader(\n        () =\u003e {\n          setOffscreen(false);\n          onVisibilitySet(true);\n        },\n        containerRef || ref,\n      );\n    }\n\n    return () =\u003e null;\n  }, [eager]);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptedalchemy%2Fintersection-observer-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptedalchemy%2Fintersection-observer-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptedalchemy%2Fintersection-observer-hooks/lists"}