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 和 Vue 的区别 | HZFE - 剑指前端 Offer #70

Open
utterances-bot opened this issue Aug 21, 2022 · 2 comments
Open

谈谈 React 和 Vue 的区别 | HZFE - 剑指前端 Offer #70

utterances-bot opened this issue Aug 21, 2022 · 2 comments

Comments

@utterances-bot
Copy link

谈谈 React 和 Vue 的区别 | HZFE - 剑指前端 Offer

回答关键点

https://febook.hzfe.org/awesome-interview/book4/frame-react-vs-vue

Copy link

React 倾向于函数式编程,view = f(state),鼓励使用不可变数据,当 state 发生改变时,react 默认会使用浅比较来对比状态的差异,更具对比结果决定是否更新视图。

这句话中“更具”应该改为“根据”

Copy link

1314mxc commented Mar 12, 2023

“Vue 通过 defineProperty 监听数据的改动,可以做到在数据改变时,精准细粒度的更新对应的视图。”
完全靠响应式数据去更新数据变化是1.0的。2.0后引入vnode后采用组件级watcher配合diff实现。因为如果粒度太细会导致更新不精确的问题,而且defineProperty内部是watcher,如果给每个属性都添加watcher用于更新的话会产生大量watcher降低性能。

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

3 participants