Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React Authentication!
You have completed React Authentication!
Preview
In this video we’ll practice our cookie manipulation skills by preserving the theme states. We’ll practice how to set a cookie and update the cookie with a new value.
Resources
Check Cookies in Firefox:
- Open developer console by right clicking and selecting Inspect Element
- Go to Storage tab
- Expand the Cookies menu and select "http://localhost:3000"
Check Cookies in Safari:
- Open developer console by right clicking and selecting Inspect Element
- Go to Storage tab
- Click on Cookies
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
When we update the settings
preferences and reload the page,
0:00
all our settings are reset
back to the default.
0:04
Let's fix that.
0:08
The file ThemeContext.js contains
our states that control the theme.
0:09
We'll start off by importing cookies
with import Cookies from 'js-cookie'.
0:18
We could create three cookies,
one for each thing.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up