SolWipe logoSolWipeCheck Wallet
You might have SOL you don't know about. Check for free.
Building Solana Frontends Web3js

How to Integrate Wallet Adapter with React for Solana Apps

SW
SolWipe Team
··3 min read

Integrating a wallet adapter into your React application can significantly enhance the user experience for Solana apps, allowing users to interact seamlessly with their wallets. This guide will help you learn how to integrate Wallet Adapter React Solana, providing a step-by-step tutorial that is accessible for both beginners and seasoned developers.

Overview of Wallet Adapter

Wallet adapters are essential components in decentralized applications (dApps) built on the Solana blockchain. They enable users to connect their Solana wallets directly to your application, facilitating transactions, account management, and interactions with smart contracts.

Key Features of Wallet Adapter

  • Multiple Wallet Support: Wallet adapters allow integration with various Solana wallets, including Phantom, Sollet, and others.
  • User-Friendly: They provide a straightforward interface for users to connect their wallets, making the onboarding process easier.
  • Secure Transactions: Wallet adapters handle cryptographic signatures and ensure that private keys never leave the user's device.

By utilizing Wallet Adapter, you can streamline the Solana wallet integration process and enhance the overall functionality of your application.

Setting Up Your React Project

Before you start integrating Wallet Adapter, you need to set up your React project. If you haven’t already created a React application, you can do so using Create React App.

Step 1: Create a New React App

Open your terminal and run the following command:

npx create-react-app my-solana-app

Change into your project directory:

cd my-solana-app

Step 2: Install Required Dependencies

You will need to install the @solana/wallet-adapter library and its associated packages. Run the following command:

npm install @solana/wallet-adapter-react @solana/wallet-adapter-wallets @solana/web3.js

This command installs the core wallet adapter library along with the necessary wallet providers.

Step 3: Set Up TypeScript (Optional)

If you prefer to use TypeScript for your project, you can set it up easily. You’ll need to install TypeScript and the necessary types:

npm install --save typescript @types/react @types/react-dom

You can then rename your files from .js to .tsx and start building your application with TypeScript support.

Integrating Wallet Adapter

Now that your React project is set up, it’s time to integrate the Wallet Adapter. This process involves creating a wallet context and using it to connect the user's wallet.

Step 1: Create a Wallet Context

Create a new file named WalletProvider.js in the src directory. This file will manage the wallet connection state.

import React, { FC, ReactNode, useMemo } from 'react';
import {
    ConnectionProvider,
    WalletProvider,
} from '@solana/wallet-adapter-react';
import {
    PhantomWalletAdapter,
    SolletWalletAdapter,
} from '@solana/wallet-adapter-wallets';
import { clusterApiUrl } from '@solana/web3.js';

const WalletContextProvider: FC<{ children: ReactNode }> = ({ children }) => {
    const endpoint = useMemo(() => clusterApiUrl('devnet'), []);
    const wallets = useMemo(() => [
        new PhantomWalletAdapter(),
        new SolletWalletAdapter(),
    ], []);

    return (
        <ConnectionProvider endpoint={endpoint}>
            <WalletProvider wallets={wallets}>
                {children}
            </WalletProvider>
        </ConnectionProvider>
    );
};

export default WalletContextProvider;

Step 2: Wrap Your App with Wallet Provider

Now, you need to wrap your application with the WalletContextProvider you just created. Open src/index.js and modify it as follows:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import WalletContextProvider from './WalletProvider';

ReactDOM.render(
    <WalletContextProvider>
        <App />
    </WalletContextProvider>,
    document.getElementById('root')
);

Step 3: Connect to the Wallet

In your main application component, you can now connect to the wallet. Open src/App.js and add the following code:

import React from 'react';
import {
    useWallet,
    WalletConnectButton,
    WalletDisconnectButton,
} from '@solana/wallet-adapter-react';

const App = () => {
    const { connected } = useWallet();

    return (
        <div>
            <h1>Solana Wallet Integration</h1>
            <WalletConnectButton />
            {connected && <WalletDisconnectButton />}
            {connected ? (
                <p>Wallet connected!</p>
            ) : (
                <p>Please connect your wallet.</p>
            )}
        </div>
    );
};

export default App;

Step 4: Style Your Components

To improve the user experience, you may want to add some basic styling. You can create a CSS file in the src directory and import it into your App.js file. This will help users easily identify the wallet connection buttons.

Testing Your Integration

Once you have completed the integration, it’s essential to test your application to ensure the wallet connection works correctly.

Step 1: Start Your Application

Run your application with the following command:

npm start

This command starts your React app, and it should open in your default web browser.

Step 2: Connect Your Wallet

  • Ensure you have a Solana wallet installed in your browser, such as Phantom.
  • Click on the "Connect Wallet" button.
  • If all goes well, your wallet address should display on the screen.

Step 3: Troubleshoot Common Issues

If you encounter any issues during testing, consider the following:

  • Ensure that your wallet provider is correctly set up.
  • Check the console for any error messages.
  • Verify that you are connected to the correct Solana cluster, whether it's devnet, testnet, or mainnet.

Step 4: Additional Functionality

Once you have the basic wallet integration working, consider adding more features, such as:

Conclusion

Integrating Wallet Adapter React Solana into your application provides a seamless experience for users interacting with the Solana blockchain. By following this tutorial, you now have a functional wallet integration that allows users to connect their wallets securely.

For further enhancements or assistance, explore the SolWipe guide to learn how to manage your token accounts effectively or understand rent exemption explained to optimize your Solana experience.

Start building your Solana app today with the robust capabilities of the Wallet Adapter!

Recover your hidden SOL now

Connect your wallet, scan for free, and claim your locked SOL in under 30 seconds.

Find My Hidden SOL →

More from SolWipe

View all articles →
Advanced Wallet Features Multisig

10 Best Tools for Managing Squads on Solana

Squad management in the Solana ecosystem is essential for teams looking to streamline their operations and enhance collaboration. With the rise of decentralized finance and blockchain applications, managing squads effectively has become crucial. Utilizing the

Feb 20, 2026
Decentralized Storage Computing Filecoin

10 Best Use Cases for the Akash Network in 2026

The Akash Network is revolutionizing the way we think about cloud computing by providing a decentralized platform for hosting applications and services. By connecting users in need of cloud resources with providers who have excess computing power, Akash Networ

Feb 20, 2026
Privacy Cryptocurrency Mixers Zeroknowledge

10 Crypto Mixers You Should Know About in 2026

When it comes to maintaining crypto anonymity, using top crypto mixers is a crucial step for individuals looking to enhance their privacy in transactions. As the landscape of cryptocurrency continues to evolve, ensuring your digital footprint remains discreet

Feb 20, 2026
Solana Blockchain Explorers Analytics

10 Must-Know Solana Data Tools for Investors in 2023

Investing in the Solana blockchain can be both exciting and daunting. With its rapid growth and innovative technology, the need for effective Solana data tools for investors is more crucial than ever. These tools help you make informed decisions, analyze marke

Feb 20, 2026
Blockchain Technology Fundamentals Blockchains

10 Ways Consensus Algorithms Impact Blockchain Performance

Consensus algorithms are a foundational element of blockchain technology, determining how transactions are validated and how nodes in the network come to an agreement. Understanding how consensus algorithms impact blockchain performance is crucial for anyone i

Feb 20, 2026
Sol Investing Fundamentals Buying

2023 Solana Investment Trends: What You Need to Know

The Solana blockchain has gained significant traction in the crypto space, and understanding the Solana investment trends for 2023 can help you make informed decisions. As the ecosystem evolves, it’s essential to stay updated on market dynamics, emerging use c

Feb 20, 2026