useRemoveConnection
Overview
TheuseRemoveConnection 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 aConnectionWithdrawResponse 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
- Withdrawing sent connection requests
- Removing received requests (alternative to declining)
- Mass connection cleanup
- Account deactivation workflows
- Disconnecting from unwanted connections
- Managing professional network boundaries
Related Hooks
useRequestConnection- Send new connection requestsuseAcceptConnection- Accept connection requestsuseDeclineConnection- Decline connection requestsuseRemoveConnectionByUserId- Remove connection by user IDuseConnectionManager- Comprehensive connection state management

