JSFiddle - React, Tailwind, and code Playground
HTML
<p>localStorage test: This test will check for the key "My test key" in localStorage. If there is no key with that name, it will prompt you for a value to set. If the key already exists, it will show you the value.</p>
<p>To test: Try visiting this page with two different user profiles (OS accounts/browser profiles). They should both prompt you to set a value because localStorage is stored separately for each user.</p>
JavaScript
if (window.localStorage.getItem('My test key') === null)
window.localStorage.setItem('My test key', window.prompt('What would you like to put into localStorage?'));
else
window.alert('You have "' + window.localStorage.getItem('My test key') + '" in your localStorage');