Simple utility function to get and set data in your localStorage, and sessionStorage
npm install locache
import { cache } from 'locache';
var tom = {
name: 'Tom',
age: '26',
height: 'tall',
weight: '74kg'
}
cache('profile').set(tom);
var profile = cache('profile').get();
profile will now equal the following
{
name: 'Tom',
age: '26',
height: 'tall',
weight: '74kg'
}
cache('profile').remove();
import { sessionCache } from 'locache';
var tom = {
name: 'Tom',
age: '26',
height: 'tall',
weight: '74kg'
}
sessionCache('profile').set(tom);
var profile = sessionCache('profile').get();
profile will now equal the following
{
name: 'Tom',
age: '26',
height: 'tall',
weight: '74kg'
}
sessionCache('profile').remove();