[Bug] useEffect IDisposable
See original GitHub issueDear developer team. I have a problem with useEffect that when i return IDisposable object it is not called every time count state changes. Please help me. Thanks.
let count = ctx.useState 0 ctx.useEffect ( handler = (fun _ -> printf "m1" { new IDisposable with member this.Dispose(): unit = raise (Exception "a") } ), triggers = [EffectTrigger.AfterChange count] )
Issue Analytics
- State:
- Created a month ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Returning a callback from useEffect - javascript
React will call this dispose function ONLY when one of the dependencies changes or when it unmounts. to "release" stuff that no longer...
Read more >[Bug]: Can't unmount Canvas in react useEffect · Issue #8899
Uncaught Error: fabric.js: trying to initialize a canvas that has already been initialized at Canvas.
Read more >How to Properly Clean Up Effects in useEffect | by Caesar Bell
One reason for this is to avoid memory leaks. When an effect is no longer needed, it's important to properly dispose of any...
Read more >React - The Missing Parts
To me this is an argument that useEffect + setState is a poor solution for having state change in response to props. It...
Read more >How to shut down Babylon cleanly on React Route change?
Try using … this.engine.dispose(), I'm using that to clean-up a vue.js ... when the route changes and call what is returned by useEffect...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@huudev this is intentionally so. Could you give a bit more context on why reacts execution strategy is handy/needed?
fixed. (wait for release 1.0.1, should be out in a few minutes)