UNPKG
@h4wldev/react-naver-maps
Version:
latest (0.1.7)
0.1.7
0.1.6
0.1.5
0.1.4
React Navermaps API integration for modern development.
h4wldev/react-naver-maps
@h4wldev/react-naver-maps
/
src
/
hooks
/
use-previous.ts
12 lines
(8 loc)
•
250 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import { useRef, useEffect, DependencyList }
from
'react'
;
export function
usePrevious
<
T
>(
state: T, deps: DependencyList
): T | undefined
{
const
ref
= useRef<T>(); useEffect(() => {
ref
.current = state; }, deps);
return
ref
.current; }