Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99386281
useWillUnmount.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
Fri, Jan 24, 02:23
Size
412 B
Mime Type
text/x-java
Expires
Sun, Jan 26, 02:23 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23788243
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useWillUnmount.js
View Options
import useUpdatedRef from './useUpdatedRef';
import { useEffect } from 'react';
/**
* Attach a callback that fires when a component unmounts
*
* @param fn Handler to run when the component unmounts
* @category effects
*/
export default function useWillUnmount(fn) {
var onUnmount = useUpdatedRef(fn);
useEffect(function () {
return function () {
return onUnmount.current();
};
}, []);
}
Event Timeline
Log In to Comment