An array of objects in mobx, how to render only dom with changed values

I"m going to do a sortable drag, using reactdnd, http://react-dnd.github.io/re.

.

he is using the updated array of react"s setstate, but my array is stored in store. For each update, you need to create a new sorted array, and then assign a value to the original array in store. However, mobx does not seem to be able to re-render the changed dom, like react"s setstate, but this array is re-rendered, resulting in performance far less good than the example on the official website.
so I hope there is some way to solve it.

for all rendering effects caused by store assignment in mobx, please refer to the dynamic image in the link https://juejin.im/post/5a3432.

Apr.02,2021

write a comparison function to find out the changes. The efficiency of js is many times faster than operating dom.


according to your description, the problem is "not just re-rendering the changed dom". So how did you come to this conclusion? By re-rendering, do you mean the render function? If it is, react helps you do the optimization, you don't have to think about it, it's in need of optimization. It can be optimized in two ways, one is to rewrite shouldComponentUpdate. The other is to use mutable ( Note: not immutable ). For more information, please refer to https://stackoverflow.com/que.


try Immutable

Menu