![](/img/trans.png)
[英]Warning: React.createElement: type should not be null , undefined, boolean, or number
[英]React - Warning: React.createElement: type should not be null, undefined, boolean, or number
我正在嘗試在我的項目中實施此圖表
在我的React應用程序中,我創建了一個稱為ChartsGrid的組件,在其中我LineChart from './d3/LineChart'
導入LineChart from './d3/LineChart'
及其子組件HorizontalAxis
, VerticalAxis
和LinePlot
data
狀態正確構建,我在控制台中看到了
import React from 'react';
import Chart from './Chart';
import LineChart from './d3/LineChart';
export default class ChartsGrid extends React.Component{
render() {
const view = [480, 320];
const trbl = [0, 0, 0, 0]
const horizontalAxisHeight = 30;
const verticalAxisWidth = 42;
const { data } = this.props;
return (
<div className="grid">
<LineChart {...{view, trbl, data, horizontalAxisHeight, verticalAxisWidth}} />
</div>
)
}
};
我在控制台中收到此錯誤
它抱怨我在ChartsGrid
渲染方法,我不太了解可能出什么問題。 所有設置對我來說似乎都不錯,在上一個Codepen示例中 ,唯一的區別是它正在setTimeout
函數中渲染線形圖數據。
我在做什么潛在的錯誤?
添加console.log('!!!!', LineChart)
並查看是否已定義。 也許您在導入/導出時出錯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.