useRequestConnection
Overview
The useRequestConnection hook allows the current logged-in user to send a connection request to another user. Connection requests can optionally include a message and return detailed information about the created connection request.
Usage Example
Advanced Usage with Custom Message
Usage in User Cards
Bulk Connection Requests
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following fields:
The ID of the user to send a connection request to
Optional message to include with the request
Returns
The function returns a Promise that resolves to a ConnectionActionResponse object containing:
The unique ID of the created connection request
ISO date string of when the request was created
Error Handling
The hook will throw errors in the following cases:
- No project is specified
- No user ID is provided
- Network connection issues
- Server-side validation errors
- Rate limiting (if too many requests are sent)
Use Cases
This hook is commonly used in:
- User profile pages to send connection requests
- User discovery and networking features
- Professional networking interfaces
- Social platform connection systems
- Team collaboration request workflows
useAcceptConnection - Accept incoming connection requests
useDeclineConnection - Decline connection requests
useFetchConnectionStatus - Check connection status with a user
useConnectionManager - Comprehensive connection state management