Skip to content

Instantly share code, notes, and snippets.

@ManasJayanth
Created July 9, 2018 05:46
Show Gist options
  • Save ManasJayanth/25027a2a91b70e7b154c4096c7901ebb to your computer and use it in GitHub Desktop.
Save ManasJayanth/25027a2a91b70e7b154c4096c7901ebb to your computer and use it in GitHub Desktop.
prepareUpdate(
domElement,
type,
oldProps,
newProps,
rootContainerInstance,
hostContext
) {
const propKeys = new Set(
Object.keys(newProps).concat(
Object.keys(oldProps)
)
).values();
const payload = [];
for (let key of propKeys) {
if (
key !== 'children' && // text children are already handled
oldProps[key] !== newProps[key]
) {
payload.push({ [key]: newProps[key] })
}
}
return payload;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment