Skip to main content

useFetchConnectionsByUserId

Overview

The useFetchConnectionsByUserId hook fetches the list of established connections for any specified user. This is a public endpoint that allows you to view any user’s connections with pagination support, making it useful for exploring networks and discovering mutual connections.

Usage Example

Advanced Usage with State Management

Usage for Mutual Connections Discovery

Usage in User Discovery

Usage with Analytics and Insights

Parameters & Returns

Parameters

The hook returns a function that accepts an object with the following fields:
userId
string
required
page
number
1
limit
number
20

Returns

The function returns a Promise that resolves to a ConnectionsResponse object containing:

ConnectionsResponse

connections
Connection[]
Array of connection information
pagination
PaginationInfo
Pagination metadata

Connection

PaginationInfo

Error Handling

The hook will throw errors in the following cases:
  • No project is specified
  • No user ID is provided
  • Network connection issues

Use Cases

This hook is perfect for: Social Discovery:
  • Exploring user networks and finding mutual connections
  • User recommendation systems
  • Professional networking features
Analytics & Insights:
  • Network analysis and visualization
  • Connection pattern analysis
  • Social graph exploration
Public Profiles:
  • Displaying user connections on profile pages
  • Professional networking showcases
  • Community member directories

Privacy Considerations

Since this is a public endpoint, consider:
  • Implementing privacy settings for users who want to hide their connections
  • Rate limiting to prevent abuse
  • Respecting user privacy preferences
  • Providing opt-out mechanisms
  • useFetchConnections - Get connections for current user (authenticated)
  • useFetchConnectionsCountByUserId - Get connection count for any user
  • useFetchConnectionStatus - Check connection status with specific user
  • useConnectionManager - Comprehensive connection state management