Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-dom扩展出来unstable_batchedUpdates,react-lite能不能也开放这个api #87

Closed
hufeng opened this issue Dec 3, 2016 · 5 comments

Comments

@hufeng
Copy link

hufeng commented Dec 3, 2016

Hi @Lucifier129 聚大大,

在ReactDom中,对外暴露了unstable_batchedUpdates这个api,
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';

这个api对于解决react的一些级联渲染非常有用,比如redux的connect相互嵌套。
如:reduxjs/redux#125

@Lucifier129
Copy link
Owner

好,我找时间研究一下,看看能不能提供~

@hufeng
Copy link
Author

hufeng commented Dec 3, 2016

love @Lucifier129

这样就试着把我们移动端的项目切到react-lite, 非常期待!

主要我们写的iflux2 为了避免relax嵌套导致的级联渲染,也用了这个api。

@hufeng
Copy link
Author

hufeng commented Dec 3, 2016

不清楚,是不是聚大大把这个暴露出来就可以了。
https://github.com/Lucifier129/react-lite/blob/master/src/ReactDOM.js#L77

@Lucifier129
Copy link
Owner

我迁移了 ReactUpdates 的单元测试到 react-lite,看了一下具体行为,发现这一版的 react-lite 不能直接兼容这个 feature。

这个 feature 的影响范围很广,可以劫持 setState、receiveProps、forceUpdate 等各种更新途径,并且还可以无视 shouldComponentUpdate -> false 去更新组件,与特定内部 hook 实现方式有关,目前 react-lite 的实现方式没有预留这么强大的 hook。

等后面的版本支持这个特性时,我会在这里 @ 你;到时你再考虑哈~

@Lucifier129
Copy link
Owner

暂时关掉,将来有变化时再重开

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants