Overview
This guide will walk you through setting up a basic Drift application using both the core utilities and React components.Install Dependencies
First, install the required packages and their peer dependencies:See the Installation page for detailed instructions.
Initialize the SDK
Initialize the Drift SDK configuration for your target environment:The
Initialize function sets up market configurations and returns the SDK config object. This must be called before using other Drift utilities.React Integration
For React applications, use the@drift-labs/react package to access hooks, components, and providers.
Set Up Providers
Wrap your application with the The
DriftProvider:App.tsx
DriftProvider handles:- Wallet connection and state management
- Drift client initialization
- SOL balance monitoring
- Screen size tracking
- Geo-blocking checks
Use Drift Client Status
Check if the Drift client is ready before performing operations:
DriftStatus.tsx
Using Icons
The icons package provides React components for Drift’s design system:IconExample.tsx
Complete Example
Here’s a complete example putting it all together:Advanced Configuration
Custom Drift Client Config
You can provide additional Drift client configuration:Disable Specific Features
You can disable specific features of the DriftProvider:Next Steps
Core Utilities
Explore all utilities in @drift-labs/common
React Hooks
Learn about available React hooks
Components
Browse UI components
Icons
View available icons