A React-based pivot table library with drag-and-drop UI for data exploration and analysis. Current stable version is 0.11.1, released October 2024. It summarizes data into table or Plotly.js charts with an Excel-like interface. Key differentiators: full drag-and-drop reordering, Plotly chart integration via dependency injection, and maintained by Plotly. Peer dependencies include React (>=15) and react-dom. It is a React port of the jQuery-based PivotTable.js and supports table and chart renderers. The library is class-component-based and uses CSS for styling.
npm install react-pivottableVerified import paths — ran on the pinned version, not inferred.
Minimal setup: import PivotTableUI, CSS, provide array data, and render with state management.
Ensure custom aggregators are compatible with the new outlet context.
Update React to >= 16.3 if not already.
Always pass state from parent component and update via onChange callback.
Add import 'react-pivottable/pivottable.css' in your entry file.
Upgrade to 0.10.0 or later or use React-compat shims.
Follow the pattern: import Plot from 'react-plotly.js'; const PlotlyRenderers = createPlotlyRenderers(Plot);
Ensure webpack or bundler supports package exports; use full path: 'react-pivottable/lib/PivotTableUI' as fallback.
Check that the CSS file exists in node_modules/react-pivottable; use a css-loader or copy the file manually.
Provide the renderers prop with at least TableRenderers and any custom renderers.
Ensure hooks are only used in functional components; consider using a wrapper functional component.