You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And.. I won't bother describing the Login component, it's what you put on the article.
Anyway, as its described in the article, it doesn't actually work. The log in button on the Login route doesn't actually force the App.js route to refresh or to change the value that it's passing as authed prop to the PrivateRoute, so the redirect doesn't work when someone follows your guide.
So I downloaded the github code here and the code is drastically different, calculating the authed status inside the PrivateRoute rather than passing it in as a prop. And that works!
Your article was good and informative, so I thought I'd contribute by helping you fix this small issue.
The text was updated successfully, but these errors were encountered:
Reading this guide here
https://www.sitepoint.com/react-router-v4-complete-guide/
I was following it word for word, doing everything perfectly, up until the section about Protected Routes.
You say to put this in app.js
With this as the private route definition:
And.. I won't bother describing the Login component, it's what you put on the article.
Anyway, as its described in the article, it doesn't actually work. The
log in
button on the Login route doesn't actually force theApp.js
route to refresh or to change the value that it's passing asauthed
prop to the PrivateRoute, so the redirect doesn't work when someone follows your guide.So I downloaded the github code here and the code is drastically different, calculating the
authed
status inside the PrivateRoute rather than passing it in as a prop. And that works!Your article was good and informative, so I thought I'd contribute by helping you fix this small issue.
The text was updated successfully, but these errors were encountered: