import { EChartsType } from 'echarts/core' ; import { RefObject , useEffect } from 'react' ; export const useChartResize = ( containerRef , chartInstance ) => { useEffect ( ( ) => { if ( containerRef . current ) { const resizeObserver = new ResizeObserver ( ( ) => { chartInstance && chartInstance . resize ( ) ; } ) ; resizeObserver . observe ( containerRef . current ) ; return ( ) => resizeObserver . disconnect ( ) ; } } ) ; } ;