【发布时间】:2021-09-17 01:54:06
【问题描述】:
我想要做的是,有多个按钮来创建不同的元素。 标题是我运行应用程序时出现在控制台中的错误消息。
这是我的代码框link,它显示了代码和错误。点击链接打开控制台,出现错误
创建图表函数
onChartItem() {
/*eslint no-console: 0*/
console.log("adding", "n" + this.state.newCounter);
this.setState({
// Add a new item. It must have a unique key!
charts: this.state.charts.concat({
i: "n" + this.state.newCounter,
x: (this.state.charts.length * 2) % (this.state.cols || 12),
y: Infinity, // puts it at the bottom
w: 8,
h: 6
}),
// Increment the counter to ensure key is always unique.
newCounter: this.state.newCounter + 1
});
}
感谢任何建议
【问题讨论】:
标签: javascript reactjs