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.

clearTimeout() on componentWillUnmount

See original GitHub issue

I’m getting this error when i navigate to another page:

Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the ToastContainer component.

Shouldn’t the component clearTimeout() when it unmounts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ricardojrgpimentelcommented, Feb 19, 2018

Sorry for the late answer, i moved the ToastContainer to the router component parent to fix it, like you said in the last comment.

0reactions
fkhadracommented, Feb 19, 2018

You are welcome @realneeraj. @ricardojrgpimentel you were encountering that error probably for the same reason. I’ll close the issue. Feel free to create a new one is the issue is not related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better way to clearTimeout in componentWillUnmount
5. You need to save the value returned from setTimeout() somewhere and pass that in to clearTimeout() . · 3 · The value...
Read more >
Javascript – Better way to clearTimeout in componentWillUnmount ...
I have a working Loading Component that cancels out when it has been loading for 8 seconds. This code works but it feels...
Read more >
Better way to clearTimeout in componentWillUnmount-Reactjs
[Solved]-Better way to clearTimeout in componentWillUnmount-Reactjs ... componentDidMount = () => { // *** // Remember the timer handle // *** this.
Read more >
Using setTimeout in React components (including hooks)
To clear a timeout, we need to call clearTimeout with the ... Then we clear the timeout in the lifecycle function componentWillUnmount :....
Read more >
How to use clearTimeout function in react-native - Tabnine
src/components/CustomLoader.js/Pulse/componentWillUnmount. componentWillUnmount() { this.mounted = false; clearTimeout(this.
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