Redirect on Login


From @jayair on Mon Apr 10 2017 01:08:29 GMT+0000 (UTC)

Link to chapter -

Copied from original issue:


Getting this warning, and I don’t see any async in UnathenticatedRoute

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in Login (at UnauthenticatedRoute.js:27)


This means that there is a setState getting called after the component has been unmounted. On which step of the chapter are you seeing this?


I’ve implemented the “Redirect on login” code… I get that warning when I log in (from logged out state). Enter email/password, click log in, spins while loading, and then I get that warning right before it navigates home.


Did you remove this line as it talks about in the chapter?



This statement, IMHO, is misleading:

Now let’s update our Redirect component to use this when it redirects.

True, Redirect is a component, but it’s not “our’s”, it’s from react-router-dom. And true, it is that component’s code that must be modified, but wouldn’t it be clearer to direct the reader to “our” component, UnauthenticatedRoute, which includes Redirect?

Thanks for considering.


Thanks for the heads up. Edited that line a bit.