{"id":28365760,"url":"https://github.com/akshitkrnagpal/use-size-performant","last_synced_at":"2026-05-13T23:32:31.170Z","repository":{"id":56072448,"uuid":"316345358","full_name":"akshitkrnagpal/use-size-performant","owner":"akshitkrnagpal","description":"React hook to retrieve the size of an element","archived":false,"fork":false,"pushed_at":"2020-12-07T09:12:52.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-28T22:11:29.323Z","etag":null,"topics":["react","react-hooks","resize-observer","size"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/use-size-performant","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/akshitkrnagpal.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":"2020-11-26T22:03:32.000Z","updated_at":"2020-12-07T09:12:55.000Z","dependencies_parsed_at":"2022-08-15T12:40:24.648Z","dependency_job_id":null,"html_url":"https://github.com/akshitkrnagpal/use-size-performant","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/akshitkrnagpal/use-size-performant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshitkrnagpal%2Fuse-size-performant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshitkrnagpal%2Fuse-size-performant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshitkrnagpal%2Fuse-size-performant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshitkrnagpal%2Fuse-size-performant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshitkrnagpal","download_url":"https://codeload.github.com/akshitkrnagpal/use-size-performant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshitkrnagpal%2Fuse-size-performant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260643665,"owners_count":23041130,"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":["react","react-hooks","resize-observer","size"],"created_at":"2025-05-28T22:11:00.901Z","updated_at":"2025-10-24T10:48:01.594Z","avatar_url":"https://github.com/akshitkrnagpal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-size-performant\n\n\u003e React hook to retrieve the size of an element\n\n[![NPM](https://img.shields.io/npm/v/use-size-performant.svg)](https://www.npmjs.com/package/use-size-performant) \n\n## Installation\n\n```\nnpm i use-size-performant\n// or\nyarn add use-size-performant\n```\n\n## Usage\n\n### Using Ref\n\n```js\nimport useSize from \"use-size-performant\";\nconst YourComponent = () =\u003e {\n  const ref = useRef(null);\n  const { height, width } = useSize(ref);\n  return (\n    \u003cdiv ref={ref}\u003e\n      \u003cp\u003eHeight: {height}\u003c/p\u003e\n      \u003cp\u003eWidth: {width}\u003c/p\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n### Using DOM elements\n\n```js\nimport useSize from \"use-size-performant\";\nconst YourComponent = () =\u003e {\n  const dom = document.querySelector('body');\n  const { height, width } = useSize(dom);\n  return (\n    \u003cdiv\u003e\n      \u003cp\u003eHeight: {height}\u003c/p\u003e\n      \u003cp\u003eWidth: {width}\u003c/p\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n## License\n\nMIT © [Akshit Kr Nagpal](https://github.com/akshitkrnagpal)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshitkrnagpal%2Fuse-size-performant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshitkrnagpal%2Fuse-size-performant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshitkrnagpal%2Fuse-size-performant/lists"}