Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100873306
useMountEffect.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, 12:12
Size
494 B
Mime Type
text/x-java
Expires
Wed, Feb 5, 12:12 (2 d)
Engine
blob
Format
Raw Data
Handle
24041183
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useMountEffect.js
View Options
import { useEffect } from 'react';
/**
* Run's an effect on mount, and is cleaned up on unmount. Generally
* useful for interop with non-react plugins or components
*
* ```ts
* useMountEffect(() => {
* const plugin = $.myPlugin(ref.current)
*
* return () => {
* plugin.destroy()
* }
* })
* ```
* @param effect An effect to run on mount
*
* @category effects
*/
function useMountEffect(effect) {
return useEffect(effect, []);
}
export default useMountEffect;
Event Timeline
Log In to Comment