Last active
January 8, 2021 22:43
-
-
Save tfiechowski/0d04bfab87bc0cafbf7bd18b44a92a2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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