3. 因为React做了不擅长的事
This case would simply construct the virtual DOM and then draw it on real DOM.
There are no DOM changes, which Virtual DOM could excel at.
https://discuss.reactjs.org/t/reactjs-perf-on-mobile/781/4
Virtual DOM只能帮助开发者免去手动优化DOM麻烦,开发者还需要特别的设计来规
避性能瓶颈:
● 比如使用shouldComponentUpdate避免不必要的渲染
● 比如使用immutable.js来提高数据变化跟踪效率
4. 单页应用的Virtual DOM代价
● 从Virtual DOM到真实DOM的重头构建是费时的,尤其在移动端。
○ http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/
○ https://meta.discourse.org/t/the-state-of-javascript-on-android-in-2015-is-
poor/33889
● 对于单页应用来说,在路由切换时会导致Virtual DOM到DOM的重新构建,易形
成性能瓶颈,尤其当返回一个DOM已变得庞大的页面。
Root
Home
Root
Feed
/home /feed/:id
Root
Home
/home
click link backward