我为下表定义了一个类名(作为JSX的一部分)。<table class="table">
但是,一旦显示该类,就不会在表上设置该类:
var SearchResult = React.createClass({
render: function(){
return (
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Address</th>
</tr>
</thead>
<tbody>...</tbody>
</table>
);
}
});
相反,该表在Chrome-> inspect元素中显示为
<table data-reactid=".0.1.0.0">...</table>
。 最佳答案
ReactJS使用className
属性来避免使用JavaScript保留字。
<table className="table">