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

当我完成并发更新去测试批处理时,processUpdateQueue的计算问题 #58

Open
samllbin opened this issue Oct 25, 2023 · 0 comments

Comments

@samllbin
Copy link

https://github.com/BetaSu/big-react/blob/master/packages/react-reconciler/src/updateQueue.ts文件下,测试的组件就为批处理那节所写的组件,num初始值为100,click事件里有三个setNum,传入一个函数,返回num+1。在我测试的时候结果是101,按理来说是103,查看了一下processUpdateQueue,发现每次传进来的baseState都为100,应该在每次处理完update后将newState赋值给baseState,供下一个update的使用,这样结果就是103。请大佬指点一下,是我理解错了还是应该是这样的。

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

1 participant