-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FirebaseUIを使ってログイン周りを作成 #1
Conversation
"react": "17.0.2", | ||
"react-dom": "17.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 react18にするとfirebaseuiでエラーになるため、バージョンを下げることにした
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さそうです 👍 👍
export type AuthState = { | ||
isSignedIn: boolean; | ||
isLoading: boolean; | ||
userId: string | undefined; | ||
userName: string | undefined; | ||
idToken: string | undefined; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こういう書き方もあるかな〜と思いました! 🙌
type AuthState = {
type: "signedIn"
userId: string
userName: string
idToken: string
} | {
type: "loading"
} | {
type: "notSignedIn"
}
type: "signedIn"
のときだけ userId
, userName
, idToken
があると推論されるので、使う側が本来必要のないundefinedのチェックをしなくて良くなる という利点があります!
フラグが複数あると複雑なので ステート
で表現したい、というのもあります 👀
No description provided.