JS-React

CROSSx React SDK

React Provider and Hooks for integrating CROSSx embedded wallet into React applications.

If you use wagmi, see @nexus-cross/crossx-sdk-wagmi instead.
This package is for React apps that don't use wagmi.

What you can do

  • Wrap your app with CROSSxProvider for automatic session management
  • Use useAuth hook for sign-in / sign-out / auth state
  • Use useWallet hook for address, signing, and transactions
  • Use useCROSSx hook for direct SDK access and reactive state (advanced)

Quick start path

  1. Getting Started
    Install packages and set up CROSSxProvider.
  2. Authentication
    Implement login/logout with useAuth.
  3. Wallet
    Integrate wallet features with useWallet and useCROSSx.
  4. EIP-1193 Provider
    Use with ethers.js and viem inside React components.
  5. API Reference
    Check full hook signatures and return types.

Minimum integration example

import { CROSSxProvider } from '@nexus-cross/crossx-sdk-react'

ReactDOM.createRoot(document.getElementById('root')!).render(
  <CROSSxProvider config={{ projectId: 'YOUR_PROJECT_ID' }}>
    <App />
  </CROSSxProvider>
)

Notes

  • CROSSxProvider calls sdk.initialize() automatically on mount.
  • All hooks must be used within CROSSxProvider.
  • For wagmi-based projects, use @nexus-cross/crossx-sdk-wagmi instead.