Results 5 comments of Shannon Feng

### 先说结论: 如果是通过 `DOM 事件`(例如:onClick) 的`事件处理函数`调用了 setState 函数,导致 React 进行更新(或者说“调度”scheduleWork),则此时`事件处理函数`中的 setState 的行为是异步的(也就是合并更新)。 上面的评论中说了很多 setState “异步”的情况。我这里补充一下“同步”的情况,下面的例子使用了 setTimeOut,组件最后显示结果是`33` ``` jsx class App extends React.Component { constructor(props) { super(props); this.state = { count:...

``` javascript function LazyManImpl(name) { console.log(`Hi I am ${name}`); this.microQueue = []; this.macroQueue = []; this.executionContext = 'NoContext'; } LazyManImpl.prototype.eat = function (str) { this.macroQueue.push(() => { console.log(`I am eating...

``` javascript // 版本一 const reverseCharacterCase = str => [...str] .map(character => { /* TODO 验证参数 */ const charCode = character.charCodeAt(); return String.fromCharCode(charCode + (charCode > 90 ? -32 :...

centos 6.5 下好像安装不了chrome ,那就没法用这个办法了吗?@gwuhaolin