score:7

Accepted answer

I could be wrong (haven't really used React.addons.update), but I guess it looks something like

var index = this.state.items.indexOf(item);
var mutation = {}; // can't have dynamic keys in object literals :( [ yet :) ]
mutation[index] = {isSelected: {$set: true}};
var newData = React.addons.update(this.state.items, mutation);
// `mutation` looks something like
// {0: {isSelected: {$set: true}}}
// i.e. set `isSelected` of the element at index 0 to true

It would be a bit simpler if you bound the index instead of the item.


Related Query

More Query from same tag