Skip to main content
Integrating BlackSwan into a React app is straightforward with a custom hook that encapsulates SDK calls and manages loading and error state. This guide walks you through installation, hook creation, and rendering credit data in your components.

Install

Client Setup

Create a single shared client instance so you don’t re-initialise on every render:

Custom Hook

The useCreditDashboard hook fetches the credit dashboard for a given wallet and exposes data, loading, and error so consuming components can handle all three states:

Usage in a Component

Import the hook and render each state — loading, error, and success — cleanly:

App Entry Point

Wire the component into your app with a wallet address: