useRemoveConnection
Overview
The useRemoveConnection hook allows the current logged-in user to remove a connection or withdraw a connection request using the connection ID. This can be used to disconnect from someone you’re already connected to, or to withdraw a connection request you previously sent.
Usage Example
Advanced Usage for Withdrawing Requests
Usage for Disconnecting from Users
Usage in Connection Management Interface
Bulk Remove Connections
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following field:
The ID of the connection to remove
Returns
The function returns a Promise that resolves to a ConnectionWithdrawResponse object containing connection removal details.
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 doesn’t exist or is already removed
- Network connection issues
- Insufficient permissions
Use Cases
This hook is commonly used for:
Connection Management:
- Removing established connections between users
- Cleaning up connection lists
Request Management:
- Withdrawing sent connection requests
- Removing received requests (alternative to declining)
Bulk Operations:
- Mass connection cleanup
- Account deactivation workflows
Privacy Control:
- Disconnecting from unwanted connections
- Managing professional network boundaries
useRequestConnection - Send new connection requests
useAcceptConnection - Accept connection requests
useDeclineConnection - Decline connection requests
useRemoveConnectionByUserId - Remove connection by user ID
useConnectionManager - Comprehensive connection state management