{"id":18396274,"url":"https://github.com/realdennis/usekeyup","last_synced_at":"2026-05-16T17:31:32.327Z","repository":{"id":57388161,"uuid":"169864775","full_name":"realdennis/useKeyup","owner":"realdennis","description":"Package a React hook useKeyup by using `useEventTarget`.","archived":false,"fork":false,"pushed_at":"2019-09-03T14:52:27.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-16T06:19:24.645Z","etag":null,"topics":["event","keyup","react","react-hooks","useeventtarget","window"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/realdennis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-09T12:28:08.000Z","updated_at":"2020-10-21T00:55:01.000Z","dependencies_parsed_at":"2022-08-29T13:51:33.436Z","dependency_job_id":null,"html_url":"https://github.com/realdennis/useKeyup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realdennis%2FuseKeyup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realdennis%2FuseKeyup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realdennis%2FuseKeyup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realdennis%2FuseKeyup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realdennis","download_url":"https://codeload.github.com/realdennis/useKeyup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248581806,"owners_count":21128242,"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":["event","keyup","react","react-hooks","useeventtarget","window"],"created_at":"2024-11-06T02:13:17.658Z","updated_at":"2025-10-20T02:50:50.568Z","avatar_url":"https://github.com/realdennis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# useKeyup\n\nGet window size by hooks `keyup` event without side-effect.\n\n## Install\n\n```sh\n$ npm install use-keyup\n```\n\n## How to use?\n\nThis example will auto removeEventListener when component unmounted.\n\n```javascript\nimport useKeyup from 'use-keyup';\nconst demo = () =\u003e {\n  const [key, setKey] = useState([]);\n  useKeyup(e =\u003e setKey(e.code));\n  return \u003cp\u003ekeyup {key}\u003c/p\u003e;\n};\n```\n\nExplicity Clean the handler.\n\n```javascript\nimport useKeyup from 'use-keyup';\nconst demo = () =\u003e {\n  const [key, setKey] = useState([]);\n  const [cleanUp] = useKeyup(e =\u003e setKey(e.code));\n  useEffect(() =\u003e {\n    setTimeout(cleanUp, 3000);\n    // Set timer when mounted \u0026 after 3sec clean keyup\n  }, []);\n  return \u003cp\u003ekeyup {key}\u003c/p\u003e;\n};\n```\n\n## What I Do?\n\nCall clean-up function (to `removeEventListener`) when component has been unmounted.\n\nAlso, I export a `cleanUp` function, you can use this to explicity remove events when you need.\n\n## Why This has a dependency of `createEventTargetHook`\n\nThis is a hooks infrastructure for easily package a event hooks.\n\nSee more [createEventTargetHook](https://github.com/realdennis/createEventTargetHook/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealdennis%2Fusekeyup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealdennis%2Fusekeyup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealdennis%2Fusekeyup/lists"}