Skip to content

Commit 188f018

Browse files
committed
docs(use-long-press): Add installation and basic usage example to README
1 parent c199311 commit 188f018

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

packages/use-long-press/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,33 @@
1818
- Disable hook when necessary
1919
- Filter undesired events (like mouse right clicks)
2020

21+
# Installation
22+
```shell
23+
yarn add use-long-press
24+
```
25+
or
26+
```shell
27+
npm install --save use-long-press
28+
```
29+
30+
# Basic usage
31+
Basic hook usage example to get started immediately
32+
```tsx
33+
import React from 'react'; // No longer necessary in newer React versions
34+
import { useLongPress } from 'use-long-press';
35+
36+
const Example = () => {
37+
const handlers = useLongPress(() => {
38+
// Your long press handler
39+
alert('Long pressed!');
40+
});
41+
return <button {...handlers()}>Press me</button>;
42+
};
43+
```
44+
2145
# Documentation
2246

23-
Full documentation can be found [here](https://minwork.gitbook.io/long-press-hook/)
47+
Full documentation can be found [here](https://minwork.gitbook.io/long-press-hook/).
2448

2549
# Support
2650

0 commit comments

Comments
 (0)