Opens Farcaster user profiles within the host application. Defaults to the current user’s profile if no FID is specified.
Parameters
The Farcaster ID of the profile to view. If not provided, defaults to the current user’s FID from the MiniKit context.
Returns
Function that opens the specified Farcaster profile when called.
Usage Patterns
User Discovery
Enable users to explore profiles of other participants:components/ProfileList.tsx
Social Gaming
Connect players in multiplayer experiences:components/GameLobby.tsx
Creator Attribution
Link to content creators and collaborators:components/ContentAttribution.tsx
Best Practices
User Experience
- Clear call-to-action: Use descriptive button text like “View Profile” or user names
- Visual feedback: Indicate clickable profile elements with appropriate styling
- Context awareness: Show relevant profile actions based on the user’s relationship
Performance Optimization
- Memoize profile handlers: Use the same hook instance for the same FID
- Batch profile data: Load profile information efficiently when displaying multiple users
components/ProfileActions.tsx
Accessibility
- Keyboard navigation: Ensure profile links are keyboard accessible
- Screen reader support: Use semantic HTML and ARIA labels
- Focus management: Handle focus appropriately when returning from profile views
components/AccessibleProfileLink.tsx
Profile viewing behavior may vary between Farcaster clients. In Base App, profiles open within the app context. In other clients, the experience may differ based on their implementation.
Always validate FIDs before passing them to
useViewProfile
. Invalid FIDs may cause errors or unexpected behavior in the host application.