Skip to main content

Overview

Returns a function that deletes a connection record by its connectionId. This works for both withdrawing a pending sent request and disconnecting an established connection. The current user must be authenticated. If you don’t have the connection ID, use useRemoveConnectionByUserId instead.

Usage Example

import { useRemoveConnection } from "@sublay/react-js";

function DisconnectButton({ connectionId }: { connectionId: string }) {
  const removeConnection = useRemoveConnection();

  return (
    <button onClick={() => removeConnection({ connectionId })}>
      Disconnect
    </button>
  );
}

Parameters

The hook returns a function. That function accepts:
connectionId
string
required
The ID of the connection record to remove.

Returns

message
string
A confirmation message.