gpt4 book ai didi

reactjs - 如何在 ReactJS 中添加 "colSpan"属性

转载 作者:搜寻专家 更新时间:2023-10-30 20:29:53 26 4
gpt4 key购买 nike

当我尝试将 colSpan="2" 属性添加到下面的 ReactJS TypeScript 时,出现错误“Type string is not assignable to type number”代码。我该如何解决这个问题?

class ProductCategoryRow extends React.Component<MyProps, MyState> {
constructor(props: MyProps) {
super(props);
}
render() {
return (<div>
<tr><th colSpan="2">{ this.props.category }</th></tr>
</div>);
} //end render.
} //end class.

最佳答案

你试过了吗<th colSpan={2}>{ this.props.category}</th>

关于reactjs - 如何在 ReactJS 中添加 "colSpan"属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37578362/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com