JSFiddle - React, Tailwind, and code Playground
by Blink
HTML
But in browsers that don't support `sessionStorate`, that "shim" does not persist across page loads, does it? In browsers that support `sessionStorage`, the data will be stored into `sessionStorage`, but in browsers that don't support it, the data will be stored into a page-bound object that is destroyed on the next page load.
I'm not sure what the point of this wrapper is then. It creates a storage object which depends on `sessionStorage` to persist across page loads.
<br><br>
It is only meant to simulate the effects for that one session. So if a user browses my site, goes to a blog post and then back to the index again, it will be loaded from the in memory object rather than a fresh Ajax request. Sure it doesn't persist but it does the job of giving a non supported browser some of the benefit. From my post:
"One of the good things about the way sessionStorage is implemented is that we can fake a version of it with a simple in-memory object. This means users of browsers without sessionStorage can feel some of the benefit, but of course they won’t see their data persist"
Perhaps a shim is the wrong phrase, but the idea is just to offer something rather than nothing.