---
name: setup-react-app
description: Scaffold a React app with Phantom Connect SDK for wallet integration, including social login and Solana support
---
# Scaffold React App with Phantom Connect
## When to use
- User asks to set up a React app with Phantom Connect
- User wants to create a wallet-connected React project
- User wants to scaffold a Phantom integration in React
## Workflow
### Step 1: Install Dependencies
```bash
npm install @phantom/react-sdk @solana/web3.js
```
### Step 2: Configure PhantomProvider
Wrap your app's root component in `PhantomProvider` with the required configuration:
```tsx
import { PhantomProvider } from "@phantom/react-sdk";
function App() {
return (
);
}
```
**Required config fields:**
- `appId` — Register at [Phantom Portal](https://phantom.com/portal) to obtain this.
- `providers` — Social login providers to enable (e.g. `["google", "apple"]`).
- `addressTypes` — Blockchain address types to request (e.g. `["solana"]`, `["solana", "ethereum"]`).
### Step 3: Add the Connect Button
Use the built-in `ConnectButton` component for the simplest integration:
```tsx
import { ConnectButton } from "@phantom/react-sdk";
function Navbar() {
return (
);
}
```
### Step 4: Use Hooks for Wallet State
Wire up the core hooks to access wallet state and chain-specific APIs:
```tsx
import {
useConnect,
useAccounts,
useDisconnect,
useSolana,
} from "@phantom/react-sdk";
function WalletInfo() {
const { isConnected } = useConnect();
const { accounts } = useAccounts();
const { disconnect } = useDisconnect();
const solana = useSolana();
if (!isConnected) {
return