{"id":13450728,"url":"https://github.com/zattoo/use-double-click","last_synced_at":"2025-03-23T16:32:09.104Z","repository":{"id":42522476,"uuid":"261150061","full_name":"zattoo/use-double-click","owner":"zattoo","description":"React hook for combining double-click function into click event, as well as repeatable double-click","archived":false,"fork":false,"pushed_at":"2023-07-18T22:05:51.000Z","size":163,"stargazers_count":19,"open_issues_count":3,"forks_count":1,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-08-31T07:41:20.635Z","etag":null,"topics":["double-click","react","react-hooks"],"latest_commit_sha":null,"homepage":"https://medium.com/@nitzan.nashi/repeatable-double-click-and-hybrid-clicks-solution-with-usedoubleclick-hook-c6c64449abf7","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/zattoo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-04T11:02:34.000Z","updated_at":"2024-04-25T05:48:12.000Z","dependencies_parsed_at":"2024-01-07T18:23:08.139Z","dependency_job_id":null,"html_url":"https://github.com/zattoo/use-double-click","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zattoo%2Fuse-double-click","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zattoo%2Fuse-double-click/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zattoo%2Fuse-double-click/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zattoo%2Fuse-double-click/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zattoo","download_url":"https://codeload.github.com/zattoo/use-double-click/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221856438,"owners_count":16892441,"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":["double-click","react","react-hooks"],"created_at":"2024-07-31T07:00:37.711Z","updated_at":"2024-10-28T16:31:50.676Z","avatar_url":"https://github.com/zattoo.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":[],"readme":"# useDoubleClick\n\n[React hook][0] for continuous double-clicks and combining click and double-click events\n\nSee [Repeatable double-click and hybrid clicks solution with useDoubleClick hook][1] article for more details.\n\n### Install\n\n```shell\nnpm i @zattoo/use-double-click --save --save-exact\n```\n\n### Usage\n\n```jsx\nexport const Example = () =\u003e {\n    const [doubleClickCount, setDoubleClickCount] = useState(0);\n    const [clickCount, setClickCount] = useState(0);\n\n    const hybridClick = useDoubleClick(\n        () =\u003e setDoubleClickCount(doubleClickCount + 1),\n        () =\u003e setClickCount(clickCount + 1),\n    );\n\n    return (\n        \u003csection\u003e\n            \u003cp\u003eYou clicked {clickCount} times\u003c/p\u003e\n            \u003cp\u003eYou double-clicked {doubleClickCount} times\u003c/p\u003e\n            \u003cbutton\n                type=\"button\"\n                onClick={hybridClick}\n            \u003e\n                Click me\n            \u003c/button\u003e\n        \u003c/section\u003e\n    );\n}\n```\n\n### Parameters\n- `doubleClick: (event? React.SyntheticEvent) =\u003e void` - double-click function to be executed when user double-clicks (single or multiple times) on the bounded component.\n- `click?: (event? React.SyntheticEvent) =\u003e void` - click function to be executed when user clicks (single time) on the bounded component.\n- `options?: Object`\n    - `timeout?: number` - number of milliseconds to detect double-click event\n\n[0]: https://reactjs.org/docs/hooks-intro.html\n[1]: https://medium.com/@nitzan.nashi/repeatable-double-click-and-hybrid-clicks-solution-with-usedoubleclick-hook-c6c64449abf7?sk=ed5c9edf3017fb2b7b277b76217fc393\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzattoo%2Fuse-double-click","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzattoo%2Fuse-double-click","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzattoo%2Fuse-double-click/lists"}