Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100871279
useUpdateLayoutEffect.d.ts
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:42
Size
730 B
Mime Type
text/x-java
Expires
Wed, Feb 5, 11:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24046020
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useUpdateLayoutEffect.d.ts
View Options
import { EffectCallback, DependencyList } from 'react';
/**
* Runs a layout effect only when the dependencies have changed, skipping the
* initial "on mount" run. Caution, if the dependency list never changes,
* the effect is **never run**
*
* ```ts
* const ref = useRef<HTMLInput>(null);
*
* // focuses an element only if the focus changes, and not on mount
* useUpdateLayoutEffect(() => {
* const element = ref.current?.children[focusedIdx] as HTMLElement
*
* element?.focus()
*
* }, [focusedIndex])
* ```
* @param effect An effect to run on mount
*
* @category effects
*/
declare function useUpdateLayoutEffect(fn: EffectCallback, deps: DependencyList): void;
export default useUpdateLayoutEffect;
Event Timeline
Log In to Comment