React.js在onclick函数上更新状态,在渲染时导致无限循环

时间:2017-04-03 12:24:18

标签: javascript reactjs

我正在使用array.map函数在循环中渲染此代码,如此

=IF(IFNA(VLOOKUP(C2,A:B,2,FALSE),-1)<>-1,AVERAGE(B124:B130),"do something else")

//The name of the file that we want to create if it doesn't exist. $file = 'test.txt'; //Use the function is_file to check if the file already exists or not. if(!is_file($file)){ //Some simple example content. $contents = 'This is a test!'; //Save our content to the file. file_put_contents($file, $contents); } 函数内部,我正在更新状态。但是在记录状态值时,我在控制台中得到无限循环。

this.props.groups.map((group, i) => {
 return (
    <li key={i} onClick={this.selectGroup.bind(this, i)}
     <span className="name">{group.name}</span>
    </li>
 );
});

任何帮助?

0 个答案:

没有答案