-
-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clearTimeout() on componentWillUnmount #117
Comments
Hello @ricardojrgpimentel , Could you tell me which version you are using? Thanks. |
@fkhadra I'm on 3.2.1 |
Actually, the eventManager and react-transition-group use I'll try to reproduce the issue on my side also. |
I'm using react-router, and i have the When the route changes to something like |
Thanks for the explanation. I'll investigate. @ricardojrgpimentel When you navigate the toast is active or not ? |
It's active |
@ricardojrgpimentel I'm trying to reproduce the issue here: Could you modify the snippet to fit your use case please ? |
@fkhadra Please let me know the solution. Thanks in advance. |
@RealNeeraj could you share the link? The sandbox is still showing the old code. Thanks |
@fkhadra -------------------------------------------- Source code is here -------------------------------------------- class Home extends React.Component { render() { HomeLogin ! ); } } class About extends React.Component { render() { Home); } } const App = () => ( <button onClick={() => toast("hello")}>TOAST
render(, document.getElementById("root")); Basically I would do a login and if its success I would want to show a success toast and redirect the user to inner page. Hope it makes sense! |
The link is good now. Thanks |
@RealNeeraj When the toast function is called, the This is why we get:
Instead of putting const App = () => (
<Router>
<div>
<button onClick={() => toast("hello")}>TOAST</button>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/about">About</Link>
</li>
</ul>
<hr />
<Route exact path="/" component={Home} />
<Route path="/about" component={About} />
<ToastContainer />
</div>
</Router>
); |
Thanks for being a great help @fkhadra That solution makes more sense! |
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. |
Sorry for the late answer, i moved the ToastContainer to the router component parent to fix it, like you said in the last comment. |
I'm getting this error when i navigate to another page:
Shouldn't the component clearTimeout() when it unmounts?
The text was updated successfully, but these errors were encountered: