virtualdom.rst 1.0 KB

12345678910111213141516171819202122232425
  1. Virtual DOM and React
  2. ---------------------
  3. JupyterLab is based on `PhosphorJS <http://phosphorjs.github.io/>`__,
  4. which provides a flexible ``Widget`` class that handles the following:
  5. - Resize events that propagate down the Widget heirarchy.
  6. - Lifecycle events (``onBeforeDetach``, ``onAfterAttach``, etc.).
  7. - Both CSS-based and absolutely postioned layouts.
  8. In situations where these feature are needed, we recommend using
  9. Phosphor's ``Widget`` class directly.
  10. The idea of virtual DOM rendering, which became popular in the
  11. `React <https://reactjs.org/>`__ community, is a very elegant and
  12. efficient way of rendering and updating DOM content in response to
  13. model/state changes.
  14. Phosphor's ``Widget`` class integrates well with ReactJS and we are now
  15. using React in JupyterLab to render leaf content when the above
  16. capabilities are not needed.
  17. An example of using React with Phosphor can be found in the
  18. `launcher <https://github.com/jupyterlab/jupyterlab/blob/master/packages/launcher/src/index.tsx>`__
  19. of JupyterLab.