Skip to main content


The useReactFlow hook returns the React Flow instance to manipulate nodes, edges and the viewport and get informations about the current state. You can find the list of functions on the React Flow instance page.


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.


import ReactFlow, { useReactFlow } from 'reactflow';

function Flow() {
const reactFlowInstance = useReactFlow();

useEffect(() => {
}, []);

return <ReactFlow defaultNodes={[]} />;

You can find an example of how to use it here: useReactFlow example