UNPKG
@eoet/use-state-if-mounted
Version:
latest (1.0.1)
1.0.1
1.0.0
A hook for updating state only if the component is mounted.
@eoet/use-state-if-mounted
/
index.d.ts
4 lines
(2 loc)
•
152 B
TypeScript
View Raw
1
2
3
4
import
{
Dispatch
,
SetStateAction
}
from
'react'
;
export
function
useStateIfMounted<S>(
initialState
: S | (
() =>
S)): [S,
Dispatch
<
SetStateAction
<S>>];