UNPKG

cra-template-truemark

Version:

CRA Template with setups including, eslint, prettier, eslint, husky and reviewdog

24 lines (17 loc) 403 B
class LocalStorageManager { static getItem(key) { const data = localStorage.getItem(key); if (data) return JSON.parse(data); return data; } static setItem(key, value) { localStorage.setItem(key, JSON.stringify(value)); } static removeItem(key) { localStorage.removeItem(key); } static clear() { localStorage.clear(); } } export default LocalStorageManager;