Skip to content

Instantly share code, notes, and snippets.

@hyzhak
Created January 15, 2019 22:45
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 hyzhak/46f7222af672c3ba8c8c8d2b81910469 to your computer and use it in GitHub Desktop.
Save hyzhak/46f7222af672c3ba8c8c8d2b81910469 to your computer and use it in GitHub Desktop.
track frequent component diff v0.1
/**
* try to track frequent component update without real neads of update
*/
//...
componentDidUpdate (prevProp) {
console.log('componentDidUpdate ',
this.props.collectionId,
'\ndiff:\n',
Object.entries(prevProp)
.filter(([key, value]) => value !== this.props[key])
.map(([key, value]) => `- "${key}": ${value} -> ${this.props[key]}`)
.join('\n')
);
}
//..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment