Closed hufeng closed 7 years ago
好,我找时间研究一下,看看能不能提供~
不清楚,是不是聚大大把这个暴露出来就可以了。 https://github.com/Lucifier129/react-lite/blob/master/src/ReactDOM.js#L77
我迁移了 ReactUpdates 的单元测试到 react-lite,看了一下具体行为,发现这一版的 react-lite 不能直接兼容这个 feature。
这个 feature 的影响范围很广,可以劫持 setState、receiveProps、forceUpdate 等各种更新途径,并且还可以无视 shouldComponentUpdate -> false 去更新组件,与特定内部 hook 实现方式有关,目前 react-lite 的实现方式没有预留这么强大的 hook。
等后面的版本支持这个特性时,我会在这里 @ 你;到时你再考虑哈~
暂时关掉,将来有变化时再重开
Hi @Lucifier129 聚大大,
在ReactDom中,对外暴露了unstable_batchedUpdates这个api, import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
这个api对于解决react的一些级联渲染非常有用,比如redux的connect相互嵌套。 如:https://github.com/reactjs/redux/issues/125