UNPKG

@visactor/react-vchart

Version:

The react version of VChart 4.x

17 lines (13 loc) 548 B
import React from "react"; const ChartContext = React.createContext(null); ChartContext.displayName = "ChartContext"; export function withChartInstance(Component) { const Com = React.forwardRef(((props, ref) => React.createElement(ChartContext.Consumer, null, (ctx => React.createElement(Component, Object.assign({}, props, { chart: ctx.chart }, ref ? { ref: ref } : {})))))); return Com.displayName = Component.displayName || Component.name, Com; } export default ChartContext; //# sourceMappingURL=chart.js.map