useHandleConnections
このフックは、特定のハンドルまたはハンドルタイプのコネクションの配列を返します。
import { useHandleConnections } from '@xyflow/react';
export default function () {
const connections = useHandleConnections({ type: 'target', id: 'my-handle' });
return (
<div>There are currently {connections.length} incoming connections!</div>
);
}
シグネチャ
名前 | 型 |
---|---|
パラメータ |
|
type | "source" | "target" どのタイプのハンドル接続を観測したいですか? |
id? | string ハンドルのID |
nodeId? | string ノードのID、カスタムノード内で使用された場合は自動的に入力されます |
onConnect? | (connections: Connection[]) => void |
onDisconnect? | (connections: Connection[]) => void |
戻り値 |
|
HandleConnection[] |