javascript - What is the most efficient way to update an array with objects without re-rendering the entire DOM in RactiveJS? -
if have array objects in them.
var tableary = [ { id:0, name:"bob"}, { id:1, name:"tim"}, { id:2, name:"pete"}, ];
and want update tim "tim smith".
tableary[1] = { id:1, name:"tim smith"};
how do without having reset whole array?
ractive.set("table",tableary);
wouldn't force whole table re-rendered?
target set specific keypath possible:
// single property ractive.set("table.1.name", "tim smith"); // multiple properties in 1 go: ractive.set({ "table.1.name": "tim smith", "table.1.age": 12, }); // can update object var item = ractive.get('table.1'); item.name = 'tim smith'; item.age = 22; ractive.set("table.1", item);
that being said, ractive has smarts not re-rendering things of same value. though still has more comparisons.
Comments
Post a Comment