onClick
被称为:
<th onClick={() => this.handleClick(13)}>Und.</th>
行for(var key in this.state.tabs)
执行后,突然this
为undefined
?我怀疑它是否与被置于不可变函数内的屏蔽有关? 有什么问题?
class StockTable extends React.Component {
constructor(props) {
super(props);
this.state = {hidden: [], stockItems: [] tabs: {}};
}
handleClick(index) {
var table = document.getElementById('stocktable');
console.log(index);
if(13 == index)
{
console.log("starting unhiding elements of length: " + this.state.hidden.length + " \n");
this.state.hidden.forEach(function(elem){
console.log("Unhiding column " + elem + "\n");
for(var key in this.state.tabs) {