Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tfiechowski
Last active January 8, 2021 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiechowski/0d04bfab87bc0cafbf7bd18b44a92a2d to your computer and use it in GitHub Desktop.
Save tfiechowski/0d04bfab87bc0cafbf7bd18b44a92a2d to your computer and use it in GitHub Desktop.
const updatePhotos = useCallback(
(itemsUpdates) => {
const { toReset, toUpdate } = getItemsToResetAndUpdate(
itemsUpdates,
photos
);
setPendingUpdates(
update(pendingUpdates, {
$unset: toReset,
$merge: toUpdate,
})
);
performUpdates.callback();
},
[
photos, pendingUpdates, setPendingUpdates,
performUpdates, getItemsToResetAndUpdate,
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment