CODE
export default function EChart({ option, config, resize }) {
let chart = useRef(null)
let [chartEl, setChartEl] = useState(chart)
useEffect(() => {
if (resize) {
chartEl.resize()
}
if (!chartEl.current) {
chartEl.setOption(option)
}
else {
// console.log(resizeChart)
setChartEl(echarts.init(chart.current))
}
}, [option, chartEl, resize])
return (
<div className="chart" ref={chart}></div>
)
}
How to fix the setoptions doesn't exist on type MutableRefObject.
What I'm trying to do is to display the line chart canvas. but there's a error which is setoptions doesn't exist on type mutablerefobject
also the Property 'resize' does not exist on type 'MutableRefObject
question from:
https://stackoverflow.com/questions/65934253/how-to-fix-the-setoption-does-not-exist-on-type-mutablerefobject-in-react 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…