Created
January 15, 2019 22:45
-
-
Save hyzhak/46f7222af672c3ba8c8c8d2b81910469 to your computer and use it in GitHub Desktop.
track frequent component diff v0.1
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
/** | |
* 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