Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99388776
useUpdateImmediateEffect.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
Fri, Jan 24, 02:54
Size
723 B
Mime Type
text/x-java
Expires
Sun, Jan 26, 02:54 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
23788441
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useUpdateImmediateEffect.d.ts
View Options
import { DependencyList, EffectCallback } from 'react';
/**
* An _immediate_ effect that runs an effect callback when its dependency array
* changes. This is helpful for updates should must run during render, most
* commonly state derived from props; a more ergonomic version of https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
*
* ```ts
* function Example({ value }) {
* const [intermediaryValue, setValue] = useState(value);
*
* useUpdateImmediateEffect(() => {
* setValue(value)
* }, [value])
* ```
*
* @category effects
*/
declare function useUpdateImmediateEffect(effect: EffectCallback, deps: DependencyList): void;
export default useUpdateImmediateEffect;
Event Timeline
Log In to Comment