@mui/x-charts
Version:
The community edition of MUI X Charts components.
11 lines (10 loc) • 475 B
JavaScript
'use client';
import * as React from 'react';
import { ChartContext } from "./ChartContext.js";
export const useChartContext = () => {
const context = React.useContext(ChartContext);
if (context == null) {
throw new Error(['MUI X Charts: Could not find the Chart context.', 'It looks like you rendered your component outside of a ChartDataProvider.', 'This can also happen if you are bundling multiple versions of the library.'].join('\n'));
}
return context;
};