UNPKG

react-jsx-highcharts

Version:

Highcharts charts built using React components

26 lines (25 loc) 812 B
import * as React from 'react'; import HighchartsContext from '../HighchartsContext'; // This is a HOC function. // It takes a component... import { jsx as _jsx } from "react/jsx-runtime"; export default function withHighcharts(Component, Highcharts) { // ...and returns another component... return function HighchartsWrappedComponent(props) { // ... and renders the wrapped component with the context theme! // Notice that we pass through any additional props as well return /*#__PURE__*/_jsx(HighchartsProvider, { Highcharts: Highcharts, children: /*#__PURE__*/_jsx(Component, { ...props }) }); }; } export const HighchartsProvider = ({ Highcharts, children }) => /*#__PURE__*/_jsx(HighchartsContext.Provider, { value: Highcharts, children: children });