Using Local Storage for a Persisting State
Learn how to use the Local Storage API to store data inside the user's browser.
We'll cover the following...
Before we begin, let’s look at what the Local Storage API is. The Local Storage API allows us to save and read data to a user’s browser. This data is kept so we can retrieve it even after the user closes their browser. There is no expiration date on the data, and it is stored locally on the user’s machine.
We should make it clear that local storage should not be confused with session storage, which is an API similar to local storage. A difference is that for session storage, the data is clear after the user leaves the page; however, with local storage, the data is persisted.
Why use local storage?
Using local storage for any ...