1.0.3 • Published 6 months ago

nbc-use-storage v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

useStorage

사용 방법

useStorage(
  defaultValue, // 로컬 스토리지의 기본 값
  defaultKey, // 로컬 스토리지의 기본 키 값
  nextFunc, // 콜백함수(prevState,nextValue) => nextState
);

사용 예시

const TODO_STORAGE_KEY = "todos";
const concat = (prev, next) => prev.concat(next);

const [getStorage, setStorage] = useStorage([], TODO_STORAGE_KEY, concat);

getStoarge(); // todos: []
setStoarge(newTodo); // todos: [...newTodo]
1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago