Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100868771
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
Mon, Feb 3, 11:06
Size
412 B
Mime Type
text/x-java
Expires
Wed, Feb 5, 11:06 (2 d)
Engine
blob
Format
Raw Data
Handle
24045901
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