Búsqueda de sitios web

typescript - Cómo agregar el atributo "colSpan" en ReactJS


Estoy recibiendo el error "Type string is not assignable to type number" cuando intento agregar un atributo colSpan="2" al siguiente código de ReactJS con TypeScript. ¿Cómo puedo solucionarlo?

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.

Respuesta #1

¿Has probado <th colSpan={2}>{ this.props.category }</th>?

Artículos relacionados