React D3 Graph (react-d3-graph) is a React component library designed to facilitate the creation of interactive and configurable graph and network visualizations using D3.js. The current stable version is 2.6.0. The library maintains an active release cadence, with frequent updates addressing bugs and introducing enhancements, as evidenced by multiple releases in recent history. Its key differentiators include ease of use for complex graph structures, extensive configuration options for nodes and links, and the ability to render highly customizable nodes through a `node.viewGenerator` feature, allowing for diverse visual representations beyond basic shapes. It also leverages D3's powerful force-directed layout algorithms to provide dynamic and responsive graph interactions.
npm install react-d3-graphVerified import paths — ran on the pinned version, not inferred.
This quickstart renders a basic interactive graph with three nodes and two links, demonstrating custom node colors, shapes, and link highlighting. It includes click handlers for nodes and links, and basic graph configuration for layout and appearance.
Always use version 2.4.1 or newer. Do not install or deploy applications using `react-d3-graph@2.4.0`.
Review the full changelog for `2.0.0` and test existing implementations thoroughly. Pay close attention to node ID assignments (especially '0'), link color configurations, and how fixed node positions are managed during data updates.
For nodes that require specific rectangular dimensions, update `node.size` to explicitly define both height and width if needed. For example, `{ size: { height: 50, width: 80 } }`.Ensure that the `data.nodes` array passed to the `Graph` component is never empty. If dynamically managing data, implement checks to prevent rendering when no nodes are present.
Upgrade to `react-d3-graph@2.6.0` or newer. If staying on older versions, be aware of potential inconsistencies in arrow color when programmatically changing link colors.
Ensure that the `data.nodes` array has at least one node object defined before rendering the `Graph` component.
Verify the structure and completeness of your `data.nodes` and `data.links` objects. Ensure `id` properties are unique and consistent across nodes and links. If updating data dynamically, use `React.useState` or similar mechanisms to ensure immutability and proper reconciliation.
This specific bug was addressed in `react-d3-graph@2.0.1` and later versions. Upgrade your `react-d3-graph` package to the latest stable release (2.6.0 or newer) to resolve this.
Upgrade `react-d3-graph` to version `2.2.0` or newer. This issue was resolved through bug fixes in later releases, improving compatibility with custom node rendering using `node.viewGenerator`.