Skip to main content

useEdges

This hook returns the edges. The component that uses this hook re-renders whenever an edge changes.

caution

This hook can only be used if the component that uses it is wrapped with a ReactFlowProvider or if it's a child of the <ReactFlow /> component.

Usage

import ReactFlow, { useEdges } from 'reactflow;

function EdgeLogger() {
const edges = useEdges();

useEffect(() => {
console.log(edges);
}, [edges]);

return null;
}

Typescript

useEdges(): Edge[]