The Git tag for this section is local-storage.
Let's update our app to save the current state to local storage, which is a persistent data store managed by the user's web browser. Each executed statement will cause the entire set of parsed tokens to be saved. When the user opens the app, the tokens will be read and replayed through the parser.
As a reminder, the parser (in src/parser.js) has a function parseTokens. This is the function we'll call from within our middleware, and in this section, we'll build tests to assert that we've called this function.
We'll write a new piece of Redux middleware for the task. The middleware will pull out only two pieces of the script state: the name and the parsedTokens.
The local storage API is fairly straightforward:
- window.localStorage.getItem(key) returns the value...