import React , { createContext , Dispatch , ReactNode , SetStateAction , useState , } from 'react' ; import { PointerEvent } from '@elastic/charts' ; export const ChartPointerEventContext = createContext < { pointerEvent : PointerEvent | null ; setPointerEvent : Dispatch < SetStateAction < PointerEvent | null > > ; } | null > ( null ) ; export function ChartPointerEventContextProvider ( { children , } ) { const [ pointerEvent , setPointerEvent ] = useState < PointerEvent | null > ( null ) ; return ( < ChartPointerEventContext . Provider value = { { pointerEvent , setPointerEvent } } children = { children } / > ) ; }