UNPKG

@fewcha/web3-react

Version:

Check the documentation at https://docs.fewcha.app/

22 lines (17 loc) 384 B
export class LocalStorage { constructor(reducerKey) { this.reducerKey = ""; this.reducerKey = reducerKey; } get(defaultData) { const data = localStorage.getItem(this.reducerKey); if (data) { return JSON.parse(data); } return defaultData; } set(data) { localStorage.setItem(this.reducerKey, JSON.stringify(data)); return data; } }