You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`useDoubleClick` is a React hook that differentiates between single and double click events. It delays the single click callback execution for a specified time, and cancels it if a second click (i.e. a double click) occurs within that time.
4
+
5
+
## Interface
6
+
7
+
```ts
8
+
function useDoubleClick<EextendsHTMLElement>(
9
+
params:Object
10
+
): (event:MouseEvent<E>) =>void;
11
+
```
12
+
13
+
### Parameters
14
+
15
+
<Interface
16
+
required
17
+
name="params"
18
+
type="Object"
19
+
description="Configuration options for click handling."
20
+
:nested="[
21
+
{
22
+
name: 'params.delay',
23
+
type: 'number',
24
+
required: false,
25
+
defaultValue: '250',
26
+
description:
27
+
'The number of milliseconds to wait before triggering the single click callback. Defaults to 250ms.',
28
+
},
29
+
{
30
+
name: 'params.click',
31
+
type: '(event: MouseEvent<E>) => void',
32
+
required: false,
33
+
description: 'The callback function to be executed on a single click.',
34
+
},
35
+
{
36
+
name: 'params.doubleClick',
37
+
type: '(event: MouseEvent<E>) => void',
38
+
required: true,
39
+
description:
40
+
'The callback function to be executed on a double click. Required.',
41
+
},
42
+
]"
43
+
/>
44
+
45
+
### Return Value
46
+
47
+
<Interface
48
+
name=""
49
+
type="(event: MouseEvent<E>) => void"
50
+
description="click handler function to attach to an element's <code>onClick</code> event."
0 commit comments