File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## use-in-viewport
2
+
3
+ ** React hook for check if the current element in viewport.**
4
+
5
+ ** Author**
6
+
7
+ - name: _ Martik Avagyan_
8
+ - email: _ < martikavagyan1@gmail.com > _
9
+ - github: _ [ m-avagyan] ( https://github.com/m-avagyan ) _
10
+
11
+ ## Getting started
12
+
13
+ ** Installation**
14
+
15
+ ` npm install use-in-viewport ` or ` yarn add use-in-viewport `
16
+
17
+ ** Example**
18
+
19
+ ``` javascript
20
+ import React , { useRef } from ' react' ;
21
+ import useInViewport from ' use-in-viewport' ;
22
+
23
+ function Example () {
24
+ const elementRef = useRef (null );
25
+ const inViewport = useInViewport (elementRef);
26
+
27
+ return (
28
+ < div ref= {inViewport}>
29
+ Element is {inViewport ? ' in viewport' : ' not in viewport' }
30
+ < / div>
31
+ );
32
+ }
33
+
34
+ export default Example ;
35
+ ```
36
+
37
+ ---
38
+
39
+ ** Copyright (c) 2022 [ Martik Avagyan] ( https://github.com/m-avagyan ) **
You can’t perform that action at this time.
0 commit comments