Skip to content

Instantly share code, notes, and snippets.

@Bartmr
Last active February 17, 2023 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bartmr/b6845316d5513f1f59ed0002e3675ed3 to your computer and use it in GitHub Desktop.
Save Bartmr/b6845316d5513f1f59ed0002e3675ed3 to your computer and use it in GitHub Desktop.
Firebase Auth with React
firebase.auth.onAuthStateChanged((user) => {
if(user) {
setSession({
data: {
user
},
});
} else {
setSession({
data: null,
});
}
}, (error: unknown) => {
console.error(error)
setSession({
error: error,
data: session.data
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment