question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tear down with useEffect cleanup functions

See original GitHub issue

It seems that using screen.destroy() to tear down my application doesn’t cause useEffect cleanup functions to be called.

Right now I’m working around with a wrapper container that I can tell to de-render its children prior to calling screen.destroy. Is there a better way?

I’m using the 0.7.0 release.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Yomguitherealcommented, Mar 8, 2021

Ok, v0.7.1 is live on npm with the fix. Will close this issue then.

0reactions
gronercommented, Mar 8, 2021

Hi @Yomguithereal,

This change seems good. My application is able to cleanup and exit without using the Unmounter wrapper.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tearing Down the useEffect hook
I recently took up the task of clearing up the reported issues for react-insta-stories , an open source React component I had made...
Read more >
Demystifying useEffect's clean-up function
useEffect's clean-up function can be pretty confusing, especially if you're still trying to think in lifecycle methods. Let's clarify the clean-up function ......
Read more >
Avoid Memory Leaks and Improve Performance with ...
Avoid memory leaks and improve performance in React with cleanup functions in the useEffect hook. Learn how to cancel side effects before a...
Read more >
Cleaning up Async Functions in React's useEffect Hook ...
The instruction is pretty clear and straightforward, "cancel all subscriptions and asynchronous tasks in a useEffect cleanup function".
Read more >
Using the Effect Hook
Let's see how we could write this component with Hooks. ... Why did we return a function from our effect? This is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found