Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRemi Vledder
14,144 PointsIs there a reason cookies is used as opposed to local- or session storage?
In the React Authentication course, in the step "Preserve the User State with Cookies" cookies are used to store the state of an authenticated user.
As pointed out in https://medium.com/datadriveninvestor/cookies-vs-local-storage-2f3732c7d977, "...cookies are mainly for reading server-side, whereas local storage can only be read by the client-side."
In this case, the react app is a client side application so it seems that local storage could also be good option.
What is the reasoning behind using cookies?
1 Answer
Christopher Debove
Courses Plus Student 18,373 PointsI don't know really. localstorage would have been a better solution in this case.