React Flow, the popular library for node-based editors, workflow builders and diagrams, shipped version 13.0.0 on 16 November 2026, followed by patch releases 13.0.1 and 13.0.2. The theme of this major release is performance: the internal store has been split into several smaller stores with fine-grained subscriptions, and the library is now compiled with the React Compiler.

Most apps only need a few changes to upgrade, but some of them are easy to miss. This guide walks through the breaking changes with before-and-after code, so you can upgrade an existing React Flow 12 app in an afternoon. Sources: the official migration guide and the 13.0.0 release notes.

What’s new in React Flow 13

  • Split stores. Nodes, edges, viewport, options, connection and selection state now live in separate stores, so a change in one part re-renders fewer components.
  • Compiled with the React Compiler.
  • New hooks: useNode and useEdge to subscribe to a specific node or edge, and useEqualSelector.
  • Automatic color mode that follows your site, with forceColorMode to override.
  • Styles in @layer xyflow, plus an optional xy-theme.css.
  • changeParent helper to move a node to a new parent without recalculating its position.
  • Parent nodes no longer need to come before their children in the nodes array.
  • Selected edges are elevated by default, making overlapping edges easier to reconnect.

Step 1: Update packages and requirements

React Flow 13 requires React 18 or newer, uses Zustand 5, and no longer ships a UMD build.

npm install @xyflow/react@latest
npm install react@latest react-dom@latest   # if you're below React 18
npm update zustand                            # only if your app uses Zustand directly

Step 2: Update change handlers

onNodesChange and onEdgesChange now receive a NodeChangeset / EdgeChangeset object instead of an array. applyNodeChanges and applyEdgeChanges are no longer exported; the changeset has an applyTo() method instead.

Before (v12):

import { applyNodeChanges, applyEdgeChanges } from '@xyflow/react'

const onNodesChange = (changes) => setNodes((nds) => applyNodeChanges(changes, nds))
const onEdgesChange = (changes) => setEdges((eds) => applyEdgeChanges(changes, eds))

After (v13):

const onNodesChange = (changes) => setNodes((nds) => changes.applyTo(nds))
const onEdgesChange = (changes) => setEdges((eds) => changes.applyTo(eds))

Changesets are iterable, and you can filter by type, for example changes.getByType('remove'), which is handy for confirming deletions or syncing to a backend.

Renamed change types

If you use TypeScript, the node/edge prefixes are gone:

v12 v13
NodeDimensionChange DimensionChange
NodePositionChange PositionChange
NodeSelectionChange, EdgeSelectionChange SelectionChange
NodeRemoveChange, EdgeRemoveChange RemoveChange
NodeAddChange, EdgeAddChange AddChange
NodeReplaceChange, EdgeReplaceChange ReplaceChange

The NodeChange and EdgeChange union types still exist.

Step 3: Replace useStore

useStore is gone. Use the hook for the store you need: useNodesStore, useEdgesStore, useViewportStore, useOptionsStore, useConnectionStore or useSelectionStore.

Before:

import { useStore } from '@xyflow/react'
const nodeLookup = useStore((state) => state.nodeLookup)

After:

import { useNodesStore } from '@xyflow/react'
const nodeLookup = useNodesStore((state) => state.nodeLookup)

The new hooks don’t accept an equality function. Wrap your selector with useShallow (or use the new useEqualSelector):

import { useOptionsStore, useShallow } from '@xyflow/react'

const { minZoom, maxZoom } = useOptionsStore(
  useShallow((s) => ({ minZoom: s.minZoom, maxZoom: s.maxZoom })),
)

useStoreApi is renamed to useReactFlowStoreApi, and you pick the store explicitly:

const store = useReactFlowStoreApi()
const { nodeLookup } = store.nodesStore.getState()

A quick search finds every call site:

grep -rnE "useStore\(|useStoreApi\(|applyNodeChanges|applyEdgeChanges" src/

Step 4: Styling and color mode

Remove the colorMode prop

React Flow now detects color mode from a data-theme attribute or a dark/light class higher in the DOM. Delete colorMode and, only if you need to override the site, use forceColorMode:

<ReactFlow nodes={nodes} edges={edges} forceColorMode="dark" />

Styles are in a CSS layer

All shipped styles are wrapped in @layer xyflow. This makes overriding them easier, but if you use Tailwind CSS (which also uses layers) declare the order once at the top of your main stylesheet, as the migration guide shows:

@layer theme, base, xyflow, components, utilities;

@import 'tailwindcss';
@import '@xyflow/react/style.css';

This puts React Flow after Tailwind’s reset and before your utility classes, so utilities still win.

The style import is also shorter now: import '@xyflow/react/style.css' (the old dist/style.css path still works). To use the theme from the React Flow website, import @xyflow/react/xy-theme.css instead.

Pane cursors moved to ::before

If you customised the grab cursor, target the pseudo-element:

.react-flow__pane.draggable::before { cursor: default; }
.react-flow__pane.dragging::before { cursor: move; }

Step 5: Click, drag and viewport details

  • nodeClickDistance is removed. A node click now fires unless a drag actually moved the node. Use nodeDragThreshold to tune it.
  • paneClickDistance is now paneDragThreshold (default 1).
  • fitView and fitBounds default to 5% padding.
  • Unitless fitViewOptions.padding values are now pixels. If you passed 0.2 meaning “20%”, switch to a percentage string. The release notes give equivalents: 0.1 ≈ 4.5%, 0.5 ≈ 16.7%, 1 ≈ 25%, 2 ≈ 33%.
  • Interrupted viewport animations resolve with false instead of hanging, so await fitView() no longer stalls when the user pans mid-animation.
// v12: padding 0.5 (legacy units)
// v13: roughly the same visual result
<ReactFlow fitView fitViewOptions={{ padding: '17%' }} />

Step 6: Connections and handles

  • onConnectEnd and onReconnectEnd now receive to in flow coordinates, not screen coordinates. Remove any screenToFlowPosition call you were doing on that value.
  • useHandleConnections is removed; use useNodeConnections. getHandleConnections is replaced by getNodeConnections({ nodeId, type, handleId }).
  • The measured handle type Handle is renamed HandleBounds so it no longer collides with the <Handle /> component.

New: move nodes between parents

import { useReactFlow } from '@xyflow/react'

function MoveButton() {
  const { changeParent } = useReactFlow()
  return (
    <button onClick={() => changeParent('node-1', 'group-b')}>
      Move to group B
    </button>
  )
}

The node keeps its on-screen position, so you no longer have to convert coordinates by hand.

Upgrade checklist

  1. Upgrade to @xyflow/react@latest (13.0.2 at the time of writing) and React 18+.
  2. Replace applyNodeChanges/applyEdgeChanges with changes.applyTo().
  3. Swap useStore for the specific store hooks and wrap object selectors in useShallow.
  4. Remove colorMode; set the CSS layer order if you use Tailwind.
  5. Review fitViewOptions.padding, click thresholds and onConnectEnd math.
  6. Run your interaction tests: drag, connect, select, delete and subflows.

Takeaway

React Flow 13 trades a handful of API changes for noticeably finer-grained rendering. The biggest edits are mechanical: changes.applyTo(), the new store hooks and the CSS layer order. Work through the steps above, and keep the migration guide open for edge cases.