Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100923993
useSafeState.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Feb 4, 00:06
Size
318 B
Mime Type
text/x-java
Expires
Thu, Feb 6, 00:06 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24053366
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useSafeState.js
View Options
import
{
useCallback
}
from
'react'
;
import
useMounted
from
'./useMounted'
;
function
useSafeState
(
state
)
{
var
isMounted
=
useMounted
();
return
[
state
[
0
],
useCallback
(
function
(
nextState
)
{
if
(
!
isMounted
())
return
;
return
state
[
1
](
nextState
);
},
[
isMounted
,
state
[
1
]])];
}
export
default
useSafeState
;
Event Timeline
Log In to Comment