Skip to content

Commit e3ab9a8

Browse files
committed
[feat] localstorge 관련 유틸 작성
1 parent 02b3987 commit e3ab9a8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/utils/getLocalStorage.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default (key: string) => {
2+
const value = localStorage.getItem(key);
3+
4+
return value ? JSON.parse(value) : null;
5+
};

src/utils/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export { default as displayDate } from "./display-date";
2+
export { default as getLocalStorage } from "./getLocalStorage";
3+
export { default as setLocalStorage } from "./setLocalStorage";

src/utils/setLocalStorage.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export default (key: string, value: string) =>
2+
localStorage.setItem(key, JSON.stringify(value));

0 commit comments

Comments
 (0)