Last active
September 22, 2021 14:59
-
-
Save polluterofminds/00f75f64476645bbda067e65f6584802 to your computer and use it in GitHub Desktop.
Top Shot user-hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fcl from "@onflow/fcl" | |
import { useState, useEffect } from 'react'; | |
export function useCurrentUser() { | |
const [user, setUser] = useState(null); | |
useEffect(() => { | |
fcl.currentUser().subscribe(setUser) | |
}, []); | |
return { | |
currentUser: user, | |
logOut: fcl.unauthenticate, | |
logIn: fcl.logIn, | |
signUp: fcl.signUp, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment