Skip to content

Commit

Permalink
fix: 새로고침 시에도 userInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
uiop5809 committed Sep 2, 2024
1 parent 1a00520 commit c7a7c91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react": "^18",
"react-dom": "^18",
"recoil": "^0.7.7",
"recoil-persist": "^5.1.0",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"styled-components": "^6.1.11",
Expand Down
4 changes: 4 additions & 0 deletions src/recoil/UserInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { User } from '@/model/User'
import { atom } from 'recoil'
import { recoilPersist } from 'recoil-persist'

const { persistAtom } = recoilPersist()

export const userInfoState = atom<User | null>({
key: 'userInfoState',
default: null,
effects_UNSTABLE: [persistAtom],
})
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8534,6 +8534,11 @@ recast@^0.23.3, recast@^0.23.5:
tiny-invariant "^1.3.3"
tslib "^2.0.1"

recoil-persist@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/recoil-persist/-/recoil-persist-5.1.0.tgz#c4232fe04f2e4b6afcc815baff56f2521f6dcde1"
integrity sha512-sew4k3uBVJjRWKCSFuBw07Y1p1pBOb0UxLJPxn4G2bX/9xNj+r2xlqYy/BRfyofR/ANfqBU04MIvulppU4ZC0w==

recoil@^0.7.7:
version "0.7.7"
resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.7.7.tgz#c5f2c843224384c9c09e4a62c060fb4c1454dc8e"
Expand Down

0 comments on commit c7a7c91

Please sign in to comment.