Reputation: 2433
I'm getting the error "Type string is not assignable to type number" when I try to add a colSpan="2" attribute to the below ReactJS TypeScript code. How can I fix this?
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.
Upvotes: 53
Views: 47125
Reputation: 5427
Have you tried <th colSpan={2}>{ this.props.category}</th>
?
Upvotes: 116