Skip to content

Instantly share code, notes, and snippets.

Avatar

Pablo Ois Lagarde poislagarde

  • Buenos Aires, Argentina
View GitHub Profile
View debug_component_update_snippet.js
componentWillUpdate (nextProps, nextState) {
const componentName = this.constructor.name
const { props, state } = this
const logUpdate = (location, key, value, nextValue) => {
console.groupCollapsed(`${componentName} - ${location}.${key} changed!`)
console.log('before: ', value[key])
console.log('after: ', nextValue[key])
console.groupEnd()
}