javascript - How to implement jquery's append method without operating dom in react or vue?
漂亮男人
漂亮男人 2017-05-19 10:25:42
0
5
427

Sometimes you need to add some HTML locally. If you add traversal rendering to the array like React, all the array data will have to be re-rendered. I just want to render the original one to be added without re-rendering, so how to implement jquery append?

漂亮男人
漂亮男人

reply all(5)
为情所困

Don’t use jQuery thinking to write react or vue, think in react, thinking in vue.

Let the framework do the dirty work of updating the DOM for you. You only need to care about your data or state.

You regard the extra thing you want to add as a component. According to your needs, this component will not render at first, and then something is triggered, and this component will be rendered. Isn't this "conditional rendering"? If you look at the documentation of vue and react, how do you write conditional rendering?

What can I do if I re-render everything every time? It just executes your render function, and there is also a layer of virtual DOM diff. The actual operation on the DOM is equivalent to you executing jQuery's append.

世界只因有你

The framework will help you complete minimal updates

给我你的怀抱

React: If you plan the Component correctly and use the key attribute, the DOM operation should only have a set equivalent to append

洪涛

Since you are developing with rect or vue, you have to abandon the idea of ​​using jquery. It is recommended to read more vue react documentation

伊谢尔伦

Give up jq, start with me

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!