Skip to content

React Wrapper ​

The React package is a thin adapter over GraphEngine.

Use <Graph /> when a React application wants Graphora to own the mounted graph view while the app owns data, callbacks, and surrounding UI state.

Responsibilities ​

React owns:

  • the root div
  • engine and renderer creation
  • prop updates
  • callback delivery
  • ref access

The engine, renderer, layouts, and interactions still own graph normalization, layout execution, drawing, picking, viewport math, and interaction state helpers.

Minimal API ​

tsx
<Graph
  graph={graph}
  layout={createCircularLayout()}
  fitToViewOnLayout
  onNodeClick={(event) => {
    console.log(event.nodeId)
  }}
/>

selection can be controlled by the application. defaultSelection seeds uncontrolled selection. ref exposes engine-backed helpers such as fitToView, runLayout, setViewport, render, and selection updates.

Current Limits ​

  • React examples are Vite apps, not a docs site.
  • Custom React node renderers are deferred.
  • Context-menu and lasso helpers exist in @graphora/interactions, but React callback/overlay adapters for them are deferred.
  • Browser QA currently covers vanilla examples; React browser QA can be added after the examples stabilize.