File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/hooks/useEventListener Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,21 @@ import { usePreservedCallback } from '../usePreservedCallback/index.ts';
39
39
* }
40
40
*
41
41
* @example
42
+ * function ScrollTracker() {
43
+ * const scrollRef = useRef<HTMLDivElement>(null);
44
+ *
45
+ * useEventListener('scroll', () => {
46
+ * console.log('Scroll event detected!');
47
+ * }, scrollRef, { passive: true });
48
+ *
49
+ * return (
50
+ * <div ref={scrollRef} style={{ height: '100px', overflowY: 'scroll' }}>
51
+ * <div style={{ height: '300px' }}>Scroll Me!</div>
52
+ * </div>
53
+ * );
54
+ * }
55
+ *
56
+ * @example
42
57
* function Document() {
43
58
* useEventListener('click', (event) => {
44
59
* console.log('Document clicked at coordinates', event.clientX, event.clientY);
You can’t perform that action at this time.
0 commit comments