Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100954987
useEventCallback.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, 06:54
Size
517 B
Mime Type
text/x-java
Expires
Thu, Feb 6, 06:54 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
24060675
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useEventCallback.js
View Options
import * as React from 'react';
import useEnhancedEffect from './useEnhancedEffect';
/**
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
*/
export default function useEventCallback(fn) {
var ref = React.useRef(fn);
useEnhancedEffect(function () {
ref.current = fn;
});
return React.useCallback(function () {
return (
// @ts-expect-error hide `this`
// tslint:disable-next-line:ban-comma-operator
(0, ref.current).apply(void 0, arguments)
);
}, []);
}
Event Timeline
Log In to Comment