MinaProvider
TheMinaProvider component initializes and shares a Mina SDK instance with all child components through React context.
Import
Props
MinaProviderProps
MinaConfig
Context Value
MinaContextValue
The provider exposes the following through context:Basic Setup
Full Configuration
Next.js App Router Setup
For Next.js App Router, create a separate client component for providers:Combining with Other Providers
When using multiple providers (e.g., wagmi, TanStack Query), nest them appropriately:app/providers.tsx
MinaProvider does not depend on wagmi or TanStack Query. You can use it standalone or alongside these libraries.
Dynamic Configuration
For environment-based configuration:app/providers.tsx
Error Handling
Handle initialization errors in child components:Configuration Stability
The provider uses stable configuration comparison. If the config object reference changes but values remain the same, the SDK will not reinitialize:Best Practices
- Place provider high in the tree - Wrap your entire app or the section that needs bridge functionality
- Use
'use client'- Required for Next.js App Router - Memoize config - Prevents unnecessary re-renders
- Handle initialization states - Check
isReadyanderrorin consuming components - Use environment variables - For RPC URLs and environment-specific config
Next Steps
useMina
Access the SDK instance in components
useQuote
Fetch bridge quotes
