Questions tagged [virtual-dom]

Use virtual-dom for questions related to an object model which mimics the structure of and intercepts events normally handled by the real document object model (DOM).

The virtual-dom applies of the technique of double buffering to the DOM. It is used for many purposes, including:

  • security: sandboxing DOM mutation
  • performance: minimization of repaints and reflows
  • testing: performing static analysis on the rendered tree

References

215 questions
3
votes
2 answers

SvelteJS vs ReactJS rendering difference (repaint / reflow)

Here's my naive understanding of how the DOM and browser works Whenever something in the DOM ( the real dom ) changes the browser repaints or reflows that the DOM. So in simpler terms every time the DOM changes browser needs to recalculate the CSS,…
Omair Nabiel
  • 1,662
  • 2
  • 12
  • 24
3
votes
1 answer

How React virtual dom differ from to Ajax in functionality?

I just started to learn React JS. Learnt how react updates changes on render, how virtual dom helps to do it. I'm a dev who used ajax previously on projects. I understood the benefits and efficiency of using React. But while learning I understood…
Nitheesram Rajes
  • 138
  • 1
  • 12
3
votes
2 answers

How to change contents of a virtual dom element in Mithril?

How do I access a virtual dom element to change its contents using Mithril? I am new to Mithril and still trying to figure things out. For example, I want to access the third div with id "three" and change it's contents to "Blue Jays" without…
3
votes
2 answers

Is it correct to use dom-to-image module in reactjs app?

I'm working on a custom component in reactjs. I want to add a feature to export component as an image and PDF. Is it correct to use dom-to-image module in react? because it working with real DOM and react working with virtual DOM and i don't know…
Mohammad P
  • 79
  • 1
  • 4
3
votes
1 answer

Force redraw of img element

My Elm app lets the user rotate pictures: when a picture on the screen is clicked, elm makes an API call to rotate the picture file on the server. Following that I'd like the rotated image to show in the browser. But the virtual DOM hasn't changed…
UnluckyPaladin
  • 347
  • 2
  • 7
3
votes
2 answers

virtual-dom and shouldComponentUpdate

If I was right, the Virtual DOM in ReactJS compares the previous DOM with the current DOM i.e, formed after a change in state tree. Then why the child components rerenders when there is change in parent props. If virtual DOM renders only the DOM…
3
votes
1 answer

How is DOM and Virtual DOM represented in memory?

What's the difference, why is it faster to access Virtual DOM than just DOM?
Shreyas
  • 1,927
  • 17
  • 34
3
votes
1 answer

In React do ref's reference the virtual DOM, or the actual DOM?

I'm assuming the virtual DOM, and that React takes care of it with diff'ing. But I had a recruiter say that ref's affect the actual DOM, I can't see how this can be. I assume that they were just mistaken.
3
votes
1 answer

How to update DOM after Maquette modifies it

As mentioned previously, I want to use Maquette as a basic hyperscript language. Consequently, I don't want to use the maquette.projector. However, despite being able to append SVG objects made with Maquette to the DOM, the DOM does not seem to be…
Seanny123
  • 8,776
  • 13
  • 68
  • 124
3
votes
0 answers

How to access the React DOM in a JS injection?

I'm trying to inject some Javascript into a website build with React. The code needs access to the React Renderer. I'm running the ReactDevTools extension, which allows me to execute code like this: var elementData =…
3
votes
1 answer

What's the relationship between a React component and ReactElement?

I was reading a section of the React docs which uses the following vocabulary, but I can't figure out the relationship between them: A component A component's instance A component's backing instance A virtual DOM element A ReactElement If and how…
dayuloli
  • 16,205
  • 16
  • 71
  • 126
3
votes
2 answers

React-like programming without React

I grew up using JQuery and have been following a programming pattern which one could say is "React-like", but not using React. I would like to know how my graphics performance is doing so well, nonetheless. As an example, in my front-end, I have a…
Forhad Ahmed
  • 1,761
  • 13
  • 18
3
votes
1 answer

Does Cycle.js (virtual-dom) support anything like React's refs or mithril's config property?

In other words, is there any way to access a DOM element after it is rendered? Things like mouse focus, code highlighters, animations, how are they done in Cycle.js?
kliron
  • 4,383
  • 4
  • 31
  • 47
2
votes
1 answer

vdom is finally updating the dom (after diffing) any dom change should actually trigger repaint & reflow of entire tree, then what is the use of vdom?

This question was asked manier times whenever we change a dom , like Method 1 : document.getElementByID('root')="hello"; even for changing one dom element , the browser rerenders the whole dom and state of the other elements like input text boxes…
2
votes
0 answers

Is it good idea in React to modify attribute values of an element through Javascript?

Since React has its own copy of the DOM, what is the best way to modify an HTML element's attributes without affecting React's virtual DOM (Performance)? Let's say I want to toggle between adding and removing an active class from a list of divs…
sravis
  • 3,562
  • 6
  • 36
  • 73
1 2
3
14 15