Another piece to the web application puzzle is managing side-effects of our user’s interactions. In this lesson we’ll be interacting with the browser’s localStorage
API, but this same thing would apply if we’re interacting with a backend server, or the geolocation API, or anything else that needs to happen when the state of our component changes.
You’ll learn how to use React’s useEffect
hook to manage the side-effect of saving state into localStorage
, and also how to re-synchronize our application with the stored value in localStorage
. Learn more about viewing localStorage
in the Chrome DevTools.