{"id":26554252,"url":"https://github.com/hideba/react-hooks-geolocation","last_synced_at":"2026-05-15T20:32:53.883Z","repository":{"id":112509638,"uuid":"468326902","full_name":"HideBa/react-hooks-geolocation","owner":"HideBa","description":"React hooks for geolocation API","archived":false,"fork":false,"pushed_at":"2022-06-18T02:10:22.000Z","size":693,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T09:51:36.322Z","etag":null,"topics":["geolocation","geolocation-api","gis","react","react-hooks","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/HideBa.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":"2022-03-10T12:08:33.000Z","updated_at":"2022-04-16T07:15:02.000Z","dependencies_parsed_at":"2023-05-15T09:00:25.179Z","dependency_job_id":null,"html_url":"https://github.com/HideBa/react-hooks-geolocation","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/HideBa/react-hooks-geolocation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideBa%2Freact-hooks-geolocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideBa%2Freact-hooks-geolocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideBa%2Freact-hooks-geolocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideBa%2Freact-hooks-geolocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HideBa","download_url":"https://codeload.github.com/HideBa/react-hooks-geolocation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HideBa%2Freact-hooks-geolocation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["geolocation","geolocation-api","gis","react","react-hooks","typescript"],"created_at":"2025-03-22T09:51:14.800Z","updated_at":"2026-05-15T20:32:53.878Z","avatar_url":"https://github.com/HideBa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-hooks-geolocation\nreact-hooks-geolocation is React hooks which allows you to handle geolocation API easily with less code.\n\n# Demo\n[Here](https://react-hooks-geolocation.netlify.app/) is the demo page\n\n\n\nhttps://user-images.githubusercontent.com/49897538/163668314-5ccb26e2-c2bc-466f-bf83-8359c9d41083.mov\n\n\n\n\n\n# Getting Started\nInstall:\n\n```\nnpm install react react-hooks-geolocation\n# or\nyarn add react react-hooks-geolocation\n```\n\n# Usage\n```js\nimport useGeolocation from \"react-hooks-geolocation\";\n\n  const {location,loading,metaInfo, activate, update, watch, unwatch} = useGeolocation({defaultActive: false, (loc, meta) =\u003e {console.log(loc, meta)});\n\n  //Watch geolocation\n  const handleWatchLocation = () =\u003e {\n    watch();\n  };\n\n  //Release event handler of watching geolocation\n  const handleUnwatchLocation = () =\u003e {\n    unwatch();\n  };\n\n  //Get controll of activation\n  const activateGeolocation = () =\u003e {\n    activate();\n  };\n\n  //Update geolocation whenever you want\n  const handleUpdateGeolocation = () =\u003e {\n    update();\n  }\n\n  return(\n    \u003cdiv\u003e\n      {\n        loading ? \"loading\" : {location.latitude}\n      }\n    \u003c/div\u003e\n  )\n```\n\nType\n```ts\n\nexport type Location = {\n  latitude: number;\n  longitude: number;\n  altitude: number | null;\n};\n\nexport type MetaInfo = {\n  altitudeAccuracy: number | null;\n  accuracy: number | null;\n  heading: number | null;\n  speed: number | null;\n};\n\n\nexport type ErrType =\n  | 'PERMISSION_DENIED'\n  | 'POSITION_UNAVAILABLE'\n  | 'TIMEOUT'\n  | 'OTHER';\n\nexport type Err = {\n  type: ErrType;\n  message: string;\n};\n\nexport type Args = {\n  defaultActive?: boolean;\n  onGeolocationChange?: (location?: Location, metaInfo?: MetaInfo) =\u003e void;\n  geolocation?: Geolocation;\n};\n\n```\n\n# License\n[MIT License](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideba%2Freact-hooks-geolocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhideba%2Freact-hooks-geolocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhideba%2Freact-hooks-geolocation/lists"}