UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

11 lines (10 loc) 635 B
'use client'; import * as React from 'react'; import { ChartsContext } from "./ChartsContext.js"; export const useChartsContext = () => { const context = React.useContext(ChartsContext); if (context == null) { throw new Error('MUI X Charts: Could not find the Charts context. ' + 'This happens when the component is rendered outside of a ChartsDataProvider or ChartsContainer parent component, ' + 'which means the required context is not available. ' + 'Wrap your component in a ChartsDataProvider or ChartsContainer. ' + 'This can also happen if you are bundling multiple versions of the library.'); } return context; };