React
useSignOut()
API Documentation
Backend Services
- Authentication
- Storage
GraphQL
- AI
Client Libraries
- JavaScript
- React
- NhostClient
- <SignedIn />
- <SignedOut />
- useAccessToken()
- useAddSecurityKey()
- useAuthenticated()
- useAuthenticationStatus()
- useChangeEmail()
- useChangePassword()
- useConfigMfa()
- useDecodedAccessToken()
- useFileUpload()
- useFileUploadItem()
- useHasuraClaim()
- useHasuraClaims()
- useMultipleFilesUpload()
- useNhostClient()
- useProviderLink()
- useResetPassword()
- useSendVerificationEmail()
- useSignInAnonymous()
- useSignInEmailPassword()
- useSignInEmailPasswordless()
- useSignInEmailSecurityKey()
- useSignInPAT()
- useSignInSmsPasswordless()
- useSignOut()
- useSignUpEmailPassword()
- useSignUpEmailSecurityKeyEmail()
- useElevateSecurityKeyEmail()
- useUserAvatarUrl()
- useUserData()
- useUserDefaultRole()
- useUserDisplayName()
- useUserEmail()
- useUserId()
- useUserIsAnonymous()
- useUserLocale()
- useUserRoles()
- useSignInEmailOTP()
- useSignInIdToken()
- useLinkIdToken()
- Next.js
- Vue
- React Native
React
useSignOut()
Use the hook useSignOut
to sign out the user.
import { useSignOut, useAuthenticated } from '@nhost/react'
const Component = () => {
const { signOut } = useSignOut()
const isAuthenticated = useAuthenticated()
if (isAuthenticated) {
return <button onClick={() => signOut()}>Sign Out</button>
}
return <div>Not authenticated</div>
}
Parameters
stateAll required boolean
On this page