MCPcopy
hub / github.com/clientIO/joint / useRemoveElement

Function useRemoveElement

packages/joint-react/src/hooks/use-remove-cell.ts:37–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 * ```
36 */
37export function useRemoveElement() {
38 const graph = useGraph();
39 return useCallback(
40 (id: dia.Cell.ID) => {
41 const cell = graph.getCell(id);
42 if (!cell.isElement()) {
43 return;
44 }
45 if (cell) {
46 cell.remove();
47 }
48 },
49 [graph]
50 );
51}
52
53/**
54 * A custom hook that removes a link from the graph by its ID.

Callers

nothing calls this directly

Calls 2

useGraphFunction · 0.90
removeMethod · 0.80

Tested by

no test coverage detected