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
2
votes
3 answers

Are `h` and `createVNode` the same?

Both h and createVNode are exposed from vue. The doc seems to suggest they are the same: The h() function is a utility to create VNodes. It could perhaps more accurately be named createVNode(). But switch h to createVNode will throw:
Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
2
votes
1 answer

How can i use Bootstrap 5 Popover in react.js component?

I am using Bootstrap 5 by CDN in react. I have one component that will be using the Popover in one of the react components. So, as per the documentation, it says "You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js /…
Alak
  • 112
  • 2
  • 12
2
votes
1 answer

React rerendering - misunderstanding

I thought React was just reloading the things I needed - in my case it looks different or I've done something wrong. I have table of employees. For each employee in single day I can set start and end of work time. Like this: const ScheduleRow =…
Kishieel
  • 1,811
  • 2
  • 10
  • 19
2
votes
1 answer

Component outside of router-outlet, does not have its window.location.href updated after router redirect via guard?

I have this navigation component which sits outside of the router, it makes use of a reusable icon component which relies on the absolute url to point to SVG icons, which is retrieved via getter within the component: public get absUrl(): string { …
SebastianG
  • 8,563
  • 8
  • 47
  • 111
2
votes
2 answers

Vue and Prismic rich text: add event listener to a span node

The content of my Vue app is fetched from Prismic (an API CMS). I have a rich text block, some parts of which are wrapped inside span tags with a specific class. I want to get those span nodes with Vue and add to them an event listener. With JS,…
Bruja
  • 368
  • 2
  • 10
2
votes
0 answers

How to handle heavy render components without affecting other components on the page in ReactJS?

In my current application we have a heavy chart and some other components on the page. In the chart we have option to the user to change the timeperiod like 3months, 6months & 1 year etc. So every time user changes a value in this drop down the…
Deepak Kumar Padhy
  • 4,128
  • 6
  • 43
  • 79
2
votes
0 answers

smallest example on how virtual DOM is efficient

i have been reading many articles over this. as per my understanding, virtual DOM is simple javascript object representation of real DOM. whenever some state change happens, new Virtual DOm object is created and compared with old one using diff…
Ayyappa Gollu
  • 906
  • 7
  • 16
2
votes
2 answers

Order of setState

For example, a component has the initial state of {loading: true, setup: true} and when changing states like this: this.setState({ loading: false, setup: false }) Are there any chances at one point that loading is false and setup is still…
Anh Pham
  • 695
  • 1
  • 6
  • 21
2
votes
1 answer

HyperHTML performance when re-ordering DOM Nodes

I'm trying to understand HyperHTML and how to get the best performance out of it. Reading about how it works under the hood, it seems to imply that strong connections are made between a template and the DOM, which I take to mean that it requires a…
shennan
  • 10,798
  • 5
  • 44
  • 79
2
votes
6 answers

What actually makes update using React faster that regular UI update?

I have already read 10 articles about React and Virtual DOM. I understand that virtual DOM uses the diffing algorithm and only update the UI that was changed. But I still don't understand why that is faster than updating the actual DOM. Following…
Sandip Subedi
  • 1,039
  • 1
  • 14
  • 34
2
votes
2 answers

React | Virtual DOM Modal is not showing

I'm using React JS and Ant Design for my project. Problem I'm creating virtual DOM element. It has Popover In that there is Button and then clicking that showing Modal. It showing error Cannot read property 'setState' of undefined JS Code content =…
Maria Jeysingh Anbu
  • 3,164
  • 3
  • 34
  • 55
2
votes
2 answers

React | Virtual DOM element click event not triggering

I'm using Ant Design and React js for my Project. Problem I have a button in Popover and having click event for that button. The problem is button click event is not triggering. JS Code const content = (
Maria Jeysingh Anbu
  • 3,164
  • 3
  • 34
  • 55
2
votes
0 answers

React app being slower than regular JQuery counterpart

I've built in the past a "single page application" using nothing besides regular DOM manipulations with JQuery. Nowadays, I'm rewriting the same app with React-Redux. After re-creating a certain page from my old JQuery app, I've noticed something…
i.brod
  • 3,993
  • 11
  • 38
  • 74
2
votes
2 answers

How React Virtual DOM works with third party js plugins?

How React Virtual DOM works with third party js plugins? For instance , If we use leaflet or jquery libs which will directly communicates with real dom Then how react virtual dom handle these real dom manipulations.
2
votes
0 answers

Does explicitly setting shouldComponentUpdate() to false make the Component “Uncontrolled”?

An "Uncontrolled Component" keeps the "source of truth" in the DOM. So that puts it outside of the Virtual DOM world. For these Components React will only do the initial render once then ignore it. If a class with has shouldComponentUpdate() set to…
garrettmac
  • 8,417
  • 3
  • 41
  • 60