Skip to content

Commit 559f8ff

Browse files
committed
Clarify the mutation
1 parent 0af7de9 commit 559f8ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/04 Sortable/Simple/Card.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ const cardTarget = {
5858
// Time to actually perform the action
5959
props.moveCard(dragIndex, hoverIndex);
6060

61-
// Update the monitors item with the new index
61+
// Note: we're mutating the monitor item here!
62+
// Generally it's better to avoid mutations,
63+
// but it's good here for the sake of performance
64+
// to avoid expensive index searches.
6265
monitor.getItem().index = hoverIndex;
6366
}
6467
};

0 commit comments

Comments
 (0)