useDeclineConnection
Overview
TheuseDeclineConnection hook allows the current logged-in user to decline an incoming connection request. This permanently rejects the connection request and notifies the requester that their request was declined.
Usage Example
Advanced Usage with Confirmation
Usage in Connection Request Management
Usage with Decline Reasons
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following field:The ID of the connection request to decline
Returns
The function returns a Promise that resolves to aConnectionActionResponse object containing:
The ID of the connection request
ISO date string of when the request was declined
Error Handling
The hook will throw errors in the following cases:- No project is specified
- No user is logged in
- No connection ID is provided
- Connection request doesn’t exist or has already been processed
- Network connection issues
Best Practices
- Always confirm - Show a confirmation dialog before declining connections
- Provide feedback - Let users know the action was successful
- Handle errors gracefully - Show user-friendly error messages
- Consider reasons - Optionally collect decline reasons for analytics
- Update UI state - Remove declined requests from the UI immediately
Use Cases
This hook is commonly used in:- Connection request notification interfaces
- Professional networking platforms
- Social platform connection management
- Mobile app notification handlers
- User inbox/messages systems
Related Hooks
useAcceptConnection- Accept connection requestsuseRequestConnection- Send new connection requestsuseFetchReceivedPendingConnections- Get pending connection requestsuseConnectionManager- Comprehensive connection state management

