Answer the question
In order to leave comments, you need to log in
Individual elements on a page?
There are elements on the page that need to be changed dynamically, for example:
The likes counter under the post and under each comment from users.
In general, it is clear that you can achieve this with the help of banal jQuery. But how to organize the code in a more structured way?
Would it make sense to use React components under each such element, in other words, we have a piece of html:
<div id="app1"></div>
<div id="app2"></div>
<div id="app3"></div>
Answer the question
In order to leave comments, you need to log in
Quite possible. Thus, we are gradually transferring a large application from mvc to api based on react. Only, rather, these are not separate react applications, but simply several different entry points of one. You don't run react every time. It's just that react-house will render something into several different divs. Why not. In the end, they all look together in 1 redux store and can quite communicate through it. When the whole page was transferred to react, we combine it into one entry point. No problems, in terms of performance, including, have so far been noticed.
Don't over-optimize, yes, you can use components under each such element. You can also take a look at Vue.js to decide which is easier to write and maintain.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question