0

I want to know what is main problem between javascript and DOM that Angular / React / Vue try to solve, Please guide me I'm new learning Angular. enter image description here

0

3 Answers 3

2

React and Vue use a pattern called the Virtual DOM to optimize updating the DOM in order to render changes faster. Angular uses another method with similar motivations. Web technologies weren't originally designed to build robust applications in the browser. These frameworks attempt to enhance application performance and improve the developer and end-user experience until web standards catch up to modern use cases.

The virtual DOM (VDOM) is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. This process is called reconciliation.

Source: https://reactjs.org/docs/faq-internals.html

Sign up to request clarification or add additional context in comments.

1 Comment

I think the answer that i'm looking for is Vartual DOM thanks for explaining to me
1

Your question is one of the difference between SPA (Single Page Applications) vs MPA (Multi-page Applications).

All of Vue, React and Angular use an SPA design to only update DOM elements that are changed, instead of reloading the entire page. This is the main problem that these frameworks aim to solve instead of using vanilla javascript.

2 Comments

javascript can update DOM elements too, i didn't get your answer clearly
correct, but its 10x easier and more readable to do it in an SPA
0

The short answer to your question would be: because accessing the DOM elements is "expensive" (in terms of browser resources, memory, speed). That's why we have a Virtual DOM, a temporary copy of DOM which is purely in JS, and accessing, adding, modifying, and deleting elements is significantly faster, and that's why applications written in Angular, React or Vue has better performance.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.