batchedUpdate
// 1 unit of expiration time represents 10ms.
export function msToExpirationTime(ms: number): ExpirationTime {
// Always add an offset so that we don't clash with the magic number for NoWork.
return MAGIC_NUMBER_OFFSET - ((ms / UNIT_SIZE) | 0);
} this.setState({
count: 1
})
console.log(this.state.count)
this.setState({
count: 1
})
console.log(this.state.count)
try{
return fn(a)
} finally{
isBatchingUpdates = previousIsBatchingUpdates;
// 当我们的setState 都调用完毕后,isBatchingUpdates 会变成false。 调用performSyncWork
if(!isBatchingUpdates && !isRendering){
performSyncWork();
}
}最后更新于