{"id":26489552,"url":"https://github.com/tim-soft/use-double-click","last_synced_at":"2025-08-01T00:37:25.628Z","repository":{"id":35049998,"uuid":"200723550","full_name":"tim-soft/use-double-click","owner":"tim-soft","description":":mouse2: A simple React hook for differentiating single and double clicks on the same component.","archived":false,"fork":false,"pushed_at":"2024-04-22T09:00:51.000Z","size":1263,"stargazers_count":64,"open_issues_count":12,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T19:47:12.871Z","etag":null,"topics":["double-click","doubleclick","hook","ondblclick","react"],"latest_commit_sha":null,"homepage":"https://timellenberger.com/libraries/use-double-click","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/tim-soft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-08-05T20:23:35.000Z","updated_at":"2025-06-17T03:54:09.000Z","dependencies_parsed_at":"2024-06-18T18:29:02.134Z","dependency_job_id":"358bf0d9-c33a-4613-bf77-b7bbdca437bc","html_url":"https://github.com/tim-soft/use-double-click","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"bb787e12a9debf30247b0d5a641bcc3264d72f7b"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tim-soft/use-double-click","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-soft%2Fuse-double-click","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-soft%2Fuse-double-click/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-soft%2Fuse-double-click/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-soft%2Fuse-double-click/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tim-soft","download_url":"https://codeload.github.com/tim-soft/use-double-click/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tim-soft%2Fuse-double-click/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268147478,"owners_count":24203280,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["double-click","doubleclick","hook","ondblclick","react"],"created_at":"2025-03-20T07:41:49.279Z","updated_at":"2025-08-01T00:37:25.603Z","avatar_url":"https://github.com/tim-soft.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-double-click\n\n[![npm](https://img.shields.io/npm/v/use-double-click.svg?color=brightgreen\u0026style=popout-square)](https://www.npmjs.com/package/use-double-click)\n[![NPM](https://img.shields.io/github/license/tim-soft/use-double-click?color=brightgreen\u0026style=popout-square)](https://github.com/tim-soft/use-double-click/blob/master/LICENSE)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/use-double-click.svg?style=popout-square)\n![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=popout-square)\n[![Codecov](https://img.shields.io/codecov/c/github/tim-soft/use-double-click?style=flat-square)](https://codecov.io/gh/tim-soft/use-double-click)\n[![Travis (.org)](https://img.shields.io/travis/tim-soft/use-double-click?style=flat-square)](https://travis-ci.org/tim-soft/use-double-click)\n\nuse-double-click is a simple React hook for differentiating single and double clicks on the same component.\n\n**Documentation** [https://timellenberger.com/libraries/use-double-click](https://timellenberger.com/libraries/use-double-click)\n\n[Check out the demo on Codesandbox](https://codesandbox.io/s/use-double-click-f7e33?expanddevtools=1\u0026fontsize=14)\n\n## What's wrong with `onDoubleClick()`?\n\nWhen you double click on an element, `onClick()` fires twice alongside your single `onDoubleClick()` callback. This effect isn't desirable when a single click and a double click have different functions!\n\n`useDoubleClick()` waits within a latency window after a click for a secondary click, and only after this period either the `onSingleClick` or `onDoubleClick()` callback will fire a single time.\n\n## Install\n\n```bash\nyarn add use-double-click\n```\n\n## Usage\n\n```jsx\nimport { useRef } from 'react';\nimport useDoubleClick from 'use-double-click';\n\nconst Button = () =\u003e {\n  const buttonRef = useRef();\n  \n  useDoubleClick({\n    onSingleClick: e =\u003e {\n      console.log(e, 'single click');\n    },\n    onDoubleClick: e =\u003e {\n      console.log(e, 'double click');\n    },\n    ref: buttonRef,\n    latency: 250\n  });\n  \n  return \u003cbutton ref={buttonRef}\u003eClick Me\u003c/button\u003e\n}\n```\n\n## Props\n\n| Prop                 | Description                                                                                             |\n| -------------------- | ------------------------------------------------------------------------------------------------------- |\n| onSingleClick        | A callback function for single click events              |\n| onDoubleClick        | A callback function for double click events                                                             |\n| ref                  | Dom node to watch for double clicks                                                                     |\n| latency              | The amount of time (in milliseconds) to wait before differentiating a single from a double click        |\n\n## License\n\nMIT © [Tim Ellenberger](https://github.com/tim-soft)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftim-soft%2Fuse-double-click","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftim-soft%2Fuse-double-click","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftim-soft%2Fuse-double-click/lists"}