Core Principles
Use SDK Actions for Cross-Client Compatibility
Always use official SDK functions instead of static URLs. Static URLs can break cross-client compatibility and may leave users unable to complete actions in your Mini App.External Navigation
Opening External URLs
- With MiniKit
- Without MiniKit
Use
useOpenUrl() to safely open external websites in the client’s in-app browser:components/ExternalLinks.tsx
Composing Casts
- With MiniKit
- Without MiniKit
Use
useComposeCast() to open the native composer with prefilled content:components/ShareCast.tsx
Viewing Casts
- With MiniKit
- Without MiniKit
Use
useViewCast() to open a specific cast by its hash:components/ViewCastButton.tsx
Best Practices
1. Prioritize SDK Actions
Before implementing any navigation or linking functionality:- Check if an official SDK action exists for your use case
- Use the SDK action instead of crafting custom URLs
- Test across multiple clients to ensure compatibility
2. Handle Unsupported Features Gracefully
When using features that may not be supported in all clients:App.tsx
3. Avoid Client-Specific URLs
Don’t hardcode URLs specific to particular clients (like Warpcast URLs). Instead, use SDK actions that work across all supported clients.Common Patterns
Navigation Buttons
NavigationComponent.tsx
Conditional Navigation
ConditionalNavigation.tsx