zoukankan      html  css  js  c++  java
  • Virtual DOM--react

    Consider a DOM made of thousands of divs. Remember, we are modern web developers, our app is very SPA! We have lots of methods that handle events - clicks, submits, type-ins… A typical jQuery-like event handler looks like this:

    • find every node interested on an event
    • update it if necessary

    Which has two problems:

    1. It’s hard to manage. Imagine that you have to tweak an event handler. If you lost the context, you have to dive really deep into the code to even know what’s going on. Both time-consuming and bug-risky.
    2. It’s inefficient. Do we really need to do all this findings manually? Maybe we can be smarter and tell in advance which nodes are to-be-updated?

    https://www.cnblogs.com/feng9exe/p/10906496.html

    Virtual DOM

    1. React uses the Virtual DOM to create an in-memory copy of the browsers DOM
    2. When changing the state of components, React updates the virtual DOM first
    3. After that it computes the resulting differences, and updates the browser’s displayed DOM efficiently

    virtual DOM ReactJS

    https://blog.codecentric.de/en/2017/11/developing-modern-offline-apps-reactjs-redux-electron-part-2-reactjs-basics/

    1. The Virtual DOM: As discussed above, React.js brought in the helpful Virtual DOM - a virtual browser infinite times friendlier than the real browser. You may take it as the middleman sitting between the developer and the real browser.

      The Virtual DOM

      The Virtual DOM assists React by modeling two versions of the DOM: the original and the updated one which reflects the changes made on the view. The framework then notes the differences and updates only the parts of the UI that differ from the original. Hence, easing the previous SSR version where they had to recreate the entire updated view.

    https://dzone.com/articles/react-is-taking-over-front-end-development-why

  • 相关阅读:
    HttpClient(4.3.5)
    HttpClient(4.3.5)
    HttpClient(4.3.5)
    Apache Commons 简述
    树形结构在关系数据库中的设计
    JDK Tools
    JDK Tools
    Linux中Shell循环结构for用法笔记
    Linux有关Shell中if用法笔记
    Linux有关Shell中if用法笔记
  • 原文地址:https://www.cnblogs.com/feng9exe/p/11084558.html
Copyright © 2011-2022 走看看