Primary hook for accessing MiniKit frame context and managing frame readiness. This hook provides essential Mini App state and user context information.
Context data can be spoofed by malicious actors. Never use context data for authentication or security-critical operations. Use useAuthenticate for verified user identity.
Report incorrect code
Copy
Ask AI
// ❌ Don't use for authenticationconst isAuthenticated = !!context.user.fid; // Can be spoofed!// ✅ Use for analytics and UX hints onlyconst userHint = context.user.fid; // For analytics tracking
Use client detection to provide platform-specific experiences:
components/ClientDetection.tsx
Report incorrect code
Copy
Ask AI
const isBaseApp = context.client.clientFid === '309857';const isFarcaster = context.client.clientFid === '1';if (isBaseApp) { // Enable Base App specific features}
The useMiniKit hook must be used within a component that’s wrapped by MiniKitProvider. This hook provides the foundation for all Mini App functionality and should be one of the first hooks you use in your application.