27/Sep/2022
auh context
file
.ts
!)error 1
error 1
create us_firebase_auth.ts
add loading
, user
states
sign in 함수 async
try & catch 넣기
user
정보 유뮤에 따라서 conditional
sign out 함수 -> user
와 loading
초기화
필요한 값 return
useEffect
11:08
1. empty
dependency array => only works 1 time
unsbscribe
는 unmount 될 때 return
onAuthStateChange
에 들어갈 action
함수로 만들기state
에 대한 값을 받음.loading
처리하고 원하는 user
값 넘기고, loading false
3.코드 추가
전체코드
1. hook file
2. context file
before
after
line 22 const auth 로 반환값 넣기
3._app.tsx file
line 10 AuthUserProvider
추가
before
onclick 함수 지우고, provider 지움
useAuth에서 signInWithGoogle
가져와서 사용해주기
line 5, 8, 18