UNPKG

react-auth-kit

Version:

Authentication Library for React, which makes Token based auth very easy

31 lines (30 loc) 722 B
/** * Is Authenticated React Hook * * Call the hook to know if the user is authenticated or not * * This uses the context data to determine whether the user is authenticated * or not. * * @returns React Hook with Authtication status Functionility. * * @throws AuthError * Thrown if the Hook is used outside the Provider Scope. * * @example * ```js * import useSignIn from 'react-auth-kit/hooks/useSignIn' * * const Component = () => { * const isAuthenticated = useIsAuthenticated() * if (isAuthenticated) { * // user authenticated - do somthing * } * else { * // user not authenticated * } * ``` * */ declare function useIsAuthenticated(): boolean; export default useIsAuthenticated;