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.
Definition and Usage The colspan attribute defines the number of columns a table cell should span.
Have you tried <th colSpan={2}>{ this.props.category}</th>
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With