Skip to content

Commit

Permalink
Clarify the mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Oct 12, 2015
1 parent 0af7de9 commit 559f8ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/04 Sortable/Simple/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const cardTarget = {
// Time to actually perform the action
props.moveCard(dragIndex, hoverIndex);

// Update the monitors item with the new index
// Note: we're mutating the monitor item here!
// Generally it's better to avoid mutations,
// but it's good here for the sake of performance
// to avoid expensive index searches.
monitor.getItem().index = hoverIndex;
}
};
Expand Down

0 comments on commit 559f8ff

Please sign in to comment.