{"id":15765732,"url":"https://github.com/lucleray/keypress","last_synced_at":"2026-04-27T21:31:13.988Z","repository":{"id":96333480,"uuid":"154808136","full_name":"lucleray/keypress","owner":"lucleray","description":"⌨ a react hook for keypress events","archived":false,"fork":false,"pushed_at":"2018-10-26T09:24:48.000Z","size":167,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T06:21:17.480Z","etag":null,"topics":["hooks","keyboard","keypress","react"],"latest_commit_sha":null,"homepage":"","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/lucleray.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":"2018-10-26T09:11:50.000Z","updated_at":"2022-02-14T19:25:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e1b96b4-0deb-4cb7-8b05-3ddb8c5a6635","html_url":"https://github.com/lucleray/keypress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lucleray/keypress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucleray%2Fkeypress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucleray%2Fkeypress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucleray%2Fkeypress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucleray%2Fkeypress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucleray","download_url":"https://codeload.github.com/lucleray/keypress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucleray%2Fkeypress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32356596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"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":["hooks","keyboard","keypress","react"],"created_at":"2024-10-04T13:00:20.608Z","updated_at":"2026-04-27T21:31:13.970Z","avatar_url":"https://github.com/lucleray.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `@rehooks/keypress`\n\n\u003e React hook for keypress events at the `window` level\n\n\u003e **Note:** This is using the new [React Hooks API Proposal](https://reactjs.org/docs/hooks-intro.html)\n\u003e which is subject to change until React 16.7 final.\n\u003e\n\u003e You'll need to install `react`, `react-dom`, etc at `^16.7.0-alpha.0`\n\n## Install\n\n```sh\nyarn add @rehooks/keypress\n```\n\n## Usage\n\n```js\nimport useKeyPress from '@rehooks/keypress';\n\nfunction MyComponent() {\n  const [keys, setKeys] = useState([]);\n\n  function handleKeyPress({ key }) {\n    setKeys(keys =\u003e [key, ...keys]);\n  }\n\n  useKeyPress(handleKeyPress);\n\n  return (\n    \u003cdiv\u003e\n      \u003ch3\u003eLast keys pressed\u003c/h3\u003e\n      \u003cul\u003e\n        {keys.map(key =\u003e (\n          \u003cli\u003e{key}\u003c/li\u003e\n        ))}\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n⚡️ And you get a simple keylogger component :\n\n\u003cimg src=\"demo.gif\" width=\"200\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucleray%2Fkeypress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucleray%2Fkeypress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucleray%2Fkeypress/lists"}