UNPKG
@sky-mavis/tanto-widget
Version:
latest (0.0.5)
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
0.0.1-beta.7
0.0.1-beta.6
0.0.1-beta.5
0.0.1-beta.4
0.0.1-beta.3
0.0.1-beta.2
0.0.1-beta.1
Tanto Widget
github.com/skymavis/tanto-kit
skymavis/tanto-kit
@sky-mavis/tanto-widget
/
dist
/
mjs
/
hooks
/
useUnmount.mjs
7 lines
•
202 B
JavaScript
View Raw
1
2
3
4
5
6
7
import
{useRef,useEffect}
from
'react'
;
function
useUnmount
(
func
) {
const
funcRef =
useRef
(func); funcRef.
current
= func;
useEffect
(
() =>
() =>
{ funcRef.
current
(); }, []); }
export
{useUnmount};