Skip to main content

React Integration

This guide shows how to integrate the SatsTerminal Borrow SDK into a React application.
For a complete working application, see the official Borrow SDK Example. It demonstrates the SDK through individually composed Borrow UI registry components rather than the all-in-one BorrowApp.

Setup

Install Dependencies

Create SDK Context

Wrap Your App

Utility Imports

Import the Units utility for type-safe BTC/satoshi conversions:

Custom Hooks

useLoan Hook

usePositions Hook

useLoanHistory Hook

Components

LoanForm Component

PositionsList Component

ConnectWallet Component

Full Example App

Best Practices

1. Error Boundaries

2. Loading States

3. Optimistic Updates