File size: 337 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';

export const load = storageKey => {
  if (isBrowser) {
    return JSON.parse(window.localStorage.getItem(storageKey));
  } else if (storageKey !== undefined) {
    console.warn('storageKey support only on browser');
    return undefined;
  }
};