Answer the question
In order to leave comments, you need to log in
What is React used for?
Do I understand correctly that React on the site should be used when the DOM tree is often redrawn in it?
If I'm wrong, then explain why.
Answer the question
In order to leave comments, you need to log in
For writing SPA applications.
The main idea is not to drive data back and forth.
On the first download, you receive the client code and the initial state.
Further, only data is exchanged between you and the server.
That is, instead of 2 megabytes for each request, you transfer 10 kilobytes.
Both the server freed from markup generation and the client that saves traffic and gets a more responsive application win.
React, Vue, etc. are good at using the shadow DOM: in which the entire interface is calculated, and only what has changed is drawn into the real brake DOM.
Thus, they are great to use to make the interface responsive to user actions.
when the DOM tree is often redrawn in itnot really: when the whole DOM really needs to change often-constantly, the shadow DOM chips will not improve the situation much.
Yes. If your site does not have any interactivity, there is no point in using React.
Most often it is used when developing SPAs - because there, by definition, the DOM will need to be rebuilt often, and React allows you to abstract from this and declaratively describe the interactive UI.
A similar task is solved by other frameworks, such as Angular, Vue, Svelte.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question