Skip to main content

useAuthState

useAuthState is a basic hook that persists tokens securely on native with expo-secure-store and in local storage on web.

API

import { useAuthState } from "@flexnative/authentication";

Component

Custom hook to manage authentication state.

useAuthState Type: useAuthState(key: string): UseStateHook<string>

Props

NameTypeRequiredDefault ValueDescription
keystringtrueundefinedThe key of the authentication state item.

Output

Type definition for the useState hook.

TypeDescription
UseStateHook<T>Type definition for the useState hook.
T - The type of the state value.