Reputation: 4199
I have a table with 50 rows, each row is an item from a list.
I want to set the item as selected when I click on a checkbox in the row.
By doing it, I see that all the 50 rows are rerender.
How can I set only the specific item? (Without shouldcomponentupdate).
case ITEM_SELECTED:
const items = fromJS(state.items)
items.update(
items.findIndex(function(item) {
return item._id == action.id;
}), function(item) {
return item.selected = action.selected;
}
);
return {
...state,
items: items.toJS()
}
Thanks :)
Upvotes: 0
Views: 438
Reputation: 1999
Did you add key
to each item ? React uses key
to determine if a sibling has changed.
https://facebook.github.io/react/docs/lists-and-keys.html#keys
Upvotes: 1