namedStorage instead of useStorage
This commit is contained in:
parent
6427844da3
commit
7acad9b0f3
@ -1,9 +1,9 @@
|
||||
import { useReducer } from 'react';
|
||||
import { useLocalStorage } from '../util/PersistentStorage';
|
||||
import { namedLocalStorage } from '../util/PersistentStorage';
|
||||
import { nextState } from '../util/StateHelper';
|
||||
|
||||
const Persistent = (() => {
|
||||
const [getEnabled, setEnabled] = useLocalStorage('polling.enabled', true);
|
||||
const [getEnabled, setEnabled] = namedLocalStorage('polling.enabled', true);
|
||||
|
||||
return {
|
||||
getEnabled,
|
||||
|
@ -1,4 +1,4 @@
|
||||
export function useLocalStorage(name, initialValue) {
|
||||
export function namedLocalStorage(name, initialValue) {
|
||||
|
||||
const get = () => localStorage.getItem(name);
|
||||
const del = () => localStorage.removeItem(name);
|
||||
@ -14,7 +14,7 @@ export function useLocalStorage(name, initialValue) {
|
||||
return [get, set, del]
|
||||
}
|
||||
|
||||
export function useSessionStorage(name, initialValue) {
|
||||
export function namedSessionStorage(name, initialValue) {
|
||||
|
||||
const get = () => sessionStorage.getItem(name);
|
||||
const del = () => sessionStorage.removeItem(name);
|
||||
|
Loading…
Reference in New Issue
Block a user