Skip to main content

useCrefy Hook

The useCrefy hook allows you to access authentication state, user details, wallet info, and methods to log in or out directly from your components.

Usage

Available Exports

Type Definitions

CrefyUser

WalletInfo

Examples

Basic Authentication Check

Display User Information

Logout Functionality

Using Token for API Calls

Important Notes

Provider Required: The useCrefy hook must be used within a component tree wrapped by CrefyConnectProvider. Otherwise, it will throw an error.
Reactive Updates: The hook automatically updates when authentication state changes, so your components will re-render when users log in or out.