Chart.js
1 month ago
ChartAreaChart.js
1 month ago
ChartContext.js
1 month ago
ChartDateFilter.js
1 month ago
ChartKPI.js
1 month ago
ChartSummary.js
1 month ago
ChartTabs.js
1 month ago
index.js
1 month ago
ChartContext.js
14 lines
| 1 | import { createContext, useContext } from "@wordpress/element"; |
| 2 | |
| 3 | const ChartContext = createContext(null); |
| 4 | |
| 5 | export const useChartContext = () => { |
| 6 | const context = useContext(ChartContext); |
| 7 | if (!context) { |
| 8 | throw new Error("Chart sub-components must be used within <EngagementChart>"); |
| 9 | } |
| 10 | return context; |
| 11 | }; |
| 12 | |
| 13 | export default ChartContext; |
| 14 |