React Flow is a highly customizable React library for building interactive graphs, node-based editors, and complex flow charts. The package `reactflow` is currently at version 11.11.4, which represents the actively maintained v11 stable release line. The project maintains a consistent release cadence with frequent patch updates and less frequent minor/major releases. Key differentiators include its intuitive API for seamless zooming and panning, extensive customization options for both nodes and edges, performant rendering achieved by only re-rendering changed elements, and a rich set of hooks and utility functions for graph manipulation. It also provides essential plugin components like MiniMap, Controls, and Background out-of-the-box. The library is built with TypeScript and tested with Cypress, ensuring reliability and a robust developer experience. Users should note that the upcoming v12 release will transition to a new package name, `@xyflow/react`.
npm install reactflowVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic React Flow setup with initial nodes and edges, enabling drag, zoom, pan, and interactive connecting. It includes `MiniMap`, `Controls`, and `Background` components for enhanced user experience.
For new projects, consider installing `@xyflow/react` to use the latest v12 features. For existing v11 projects, refer to the `@xyflow/react` migration guide for detailed instructions on upgrading and adapting to the new API and package name.
Always include `import 'reactflow/dist/style.css';` in your root component or a relevant entry file to ensure proper styling.
Ensure your project's `react` and `react-dom` versions are `17.0.0` or higher. Update your `package.json` dependencies and reinstall if necessary.
Pass an object mapping your custom type names to their respective React components via the `nodeTypes` or `edgeTypes` prop: `<ReactFlow nodeTypes={nodeTypes} ... />`.Ensure all React Flow hooks are called within the top level of a functional React component. If using multiple React versions, ensure your bundler resolves to a single React instance.
Provide a defined `width` and `height` to the `div` wrapper around your `ReactFlow` component (e.g., `style={{ width: '100vw', height: '100vh' }}`). Additionally, verify that `import 'reactflow/dist/style.css';` is present in your application.Ensure all desired components are explicitly imported using named imports: `import { MiniMap, Controls, Background } from 'reactflow';`