I made a dev account just to say thank you for this! Brand new to React (in a software bootcamp course rn) and was looking for a way to do this without using a <Link> to a <Route> component which was how we were taught but had the weird effect of flashing a "/logout" endpoint in the URL. I adapted this to hook-based functional component use 'cause they didn't bother teaching us classes at all.
Discovered code through a meetup, went to bootcamp, now in my first full-time developer role.
Currently soaking up everything I can, like a big ol' knowledge sponge...
I have neglected this account for a while (especially the comments) but I'm really pleased to get your message and I'm so glad I could help. I'm honoured that you created your account to make a comment :)
Also it's really cool to see you used a functional component with a hook - hooks weren't a thing when I was at bootcamp so I missed out on those, hence the class component.
Hopefully you are still using the platform, sorry it took me 2 years to get back to you but better late than never right?!?!?!
Calie
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I made a dev account just to say thank you for this! Brand new to React (in a software bootcamp course rn) and was looking for a way to do this without using a
<Link>
to a<Route>
component which was how we were taught but had the weird effect of flashing a "/logout" endpoint in the URL. I adapted this to hook-based functional component use 'cause they didn't bother teaching us classes at all.Gavin, THANK YOU!!!
I have neglected this account for a while (especially the comments) but I'm really pleased to get your message and I'm so glad I could help. I'm honoured that you created your account to make a comment :)
Also it's really cool to see you used a functional component with a hook - hooks weren't a thing when I was at bootcamp so I missed out on those, hence the class component.
Hopefully you are still using the platform, sorry it took me 2 years to get back to you but better late than never right?!?!?!
Calie