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
0
votes
1 answer

virtual dom and real dom issue while changing state

i am calling console.log just below the setState but it showing my blank array even state has been changed. let text = reminderText; let data =…
0
votes
1 answer

Which part of code would be rendered as virtual DOM?

I'm newbie in virtual DOM topic and last days I've been thinking of how it should work. Let's imagine that I have a simple template engine in my project, for instance twig. And I'm using vue.js as a javascript framework. So I could build the…
Jarvis
  • 384
  • 2
  • 6
  • 18
0
votes
0 answers

How to filter JavaScript API/DOM requests using Javascript (VM/Interpreter/virtual DOM?)

I need to intercept and potentially rewrite/proxy various api requests such window.PostMessage, window.location.href, XHR etc. There are several solutions such xhook but these seem to work only for a small subset of APIs and only in specific…
Books
  • 153
  • 1
  • 2
  • 11
0
votes
4 answers

React.js - How to implement a function in a child component to unmount another child from the same parent, and mount another component on it's place?

For example, a component like this: import React, { Component } from 'react'; import BodyContent from './BodyContent'; import BottomOne from './BottomOne'; import BottomTwo from './BottomTwo'; class App extends Component { render() { return ( …
Mikael
  • 482
  • 8
  • 23
0
votes
2 answers

React keep to single setState call?

Supposed that in a function, i always need to set someState, and only need to set someOtherState if condition is true. Is it preferable to do it like this: this.setState({ someState }); if (condition) { this.setState({ someOtherState }); } Or…
Avery235
  • 4,756
  • 12
  • 49
  • 83
0
votes
0 answers

How to implement a function for removing some attributes in Vue.js?

Let's say we want to implement a removeInlineStyle function to receive a VNode(foo = ) and return a style-removed VNode.
Jasin Yip
  • 308
  • 1
  • 12
0
votes
1 answer

Can we do server side html rendering using jQuery?

I have a client side JS library(call it lib.js) which uses jQuery. The library fires an API using ajax and renders html based on the json response received. Due to SEO concerns, I want to create another nodejs based API, which does all the client…
0
votes
2 answers

Trying to manipulate a div with reactjs on async data

I try to animate a div with reactjs using async data via redux and it's not clear to me when can I have a reference to the virtual dom on state loaded. In my case I have a div with id header where I would like to push down the container when data…
fefe
  • 8,755
  • 27
  • 104
  • 180
0
votes
1 answer

Update React App Dynamically with JavaScript

My React app makes a third party service call to load content that needs to be injected into DOM by specified CSS selector. It can be anywhere on the page. How exactly can I inject this content into React app by specified selector to make sure…
Vad
  • 3,658
  • 8
  • 46
  • 81
0
votes
0 answers

Can someone explain this VirtualDOM concept?

I was reading this Medium article on making your own VirtualDOM and understood it until I came across this JSfiddle, specifically line 14, where it says $el.appendChild.bind($el);. It looks like he's trying to appendChild without any arguments (just…
Gabe Rogan
  • 3,343
  • 1
  • 16
  • 22
0
votes
1 answer

Angular 2 change detection issue with recursive function

I am encountering a strange issue with Angular 2 change detection when using a recursive function to read user drag & dropped files. Refer to here for the example: File drop example: plnkr.co In the example above, there are two file drop areas. The…
0
votes
1 answer

Access parent node from virtualDOM before it renders | ReactJS

I need to set component dimensions depending on parent element. Is it possible to get width and height of parent by ref from virtualDOM before it renders? Parent export default class App extends React.Component { render() { return ( …
0
votes
3 answers

Javascript:missing ) after argument error on returning a button

I am trying to return a button in some function on UI and get a wierd error. Can someone please help. var div = "" Error i get is: missing ) after argument list.
fiddle
  • 1,095
  • 5
  • 18
  • 33
0
votes
1 answer

Render Maquette without the Projector

I want to use Maquette as a basic hyperscript language. Consequently, I don't want to use the maquette.projector. However, I'm having a hard time getting any of the maquette.dom functions to work. var h = maquette.h; var dom = maquette.dom; var…
Seanny123
  • 8,776
  • 13
  • 68
  • 124
0
votes
1 answer

Performance implication of duplicate keys on React children in large lists

The React Documentation on Reconciliation says When children have keys, React uses the key to match children in the original tree with children in the subsequent tree. I understand that with every list item having a unique key, the DOM…
jacoballenwood
  • 2,787
  • 2
  • 24
  • 39