Skip to main content

React Installation

The Mina SDK provides first-class React support with hooks and a context provider for seamless integration into your React applications.

Installation

Install the SDK along with its peer dependencies.

Requirements

Import Path

React-specific exports are available from a dedicated subpath:
The /react subpath includes client-side only code. Always import React hooks from @siphoyawe/mina-sdk/react, not from the main entry point.

Framework Setup

The SDK requires client-side rendering. Mark your provider component with 'use client':
app/providers.tsx
Then use in your root layout:
app/layout.tsx
The 'use client' directive is required for any component using Mina hooks. Without it, Next.js will attempt server-side rendering which will fail.

TypeScript Configuration

Ensure your tsconfig.json supports the SDK:
tsconfig.json

Verifying Setup

Create a simple component to verify the SDK is working:
components/SDKStatus.tsx

Available Exports

The /react subpath exports: Additionally, commonly used types are re-exported for convenience:

Next Steps

MinaProvider

Configure and set up the provider

useMina Hook

Access the SDK instance