UNPKG
@jay19950328/react-hooks
Version:
latest (1.0.0)
1.0.0
0.2.0
0.1.2
0.1.1
0.1.0
0.0.2
react hooks
github.com/Jay0328/react-hooks
Jay0328/react-hooks
@jay19950328/react-hooks
/
usePrevious.js
12 lines
(9 loc)
•
207 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
React
from
'react'
;
function
usePrevious
(
value
) {
var
ref =
React
.
useRef
(value);
React
.
useEffect
(
function
(
) { ref.
current
= value; });
return
ref.
current
; }
export
default
usePrevious;