如何在React TypeScript组件中正确使用Chartist v1.3.0?
问题:React TypeScript中使用Chartist v1.3.0报错
在React TypeScript组件中使用Chartist v1.3.0时遇到错误,错误截图如下:

我的组件代码如下:
import styled from "styled-components"; import 'chartist/dist/index.css'; import { LineChart } from 'chartist'; export const ChartPage = () => { new LineChart( '#chart', { labels: [1, 2, 3, 4, 5, 6, 7, 8], series: [[5, 9, 7, 8, 5, 3, 5, 4]] }, { low: 0, showArea: true } ); return ( <div> <div id="chart"></div> </div> ) }
已尝试确保DOM元素存在等多种方法,但仍无法正常运行,希望有人协助解决该问题。
内容的提问来源于stack exchange,提问作者Nick
相关产品推荐
相关产品推荐

