Skip to content

Instantly share code, notes, and snippets.

View poislagarde's full-sized avatar

Pablo Ois Lagarde poislagarde

  • Buenos Aires, Argentina
View GitHub Profile
@poislagarde
poislagarde / debug_component_update_snippet.js
Last active February 1, 2017 16:39
React debug component update
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()
}