Skip to content

Instantly share code, notes, and snippets.

@Bo-Duke
Created August 27, 2019 12:46
Show Gist options
  • Select an option

  • Save Bo-Duke/c44a38cead9463c427e4b2e1b5af7bf4 to your computer and use it in GitHub Desktop.

Select an option

Save Bo-Duke/c44a38cead9463c427e4b2e1b5af7bf4 to your computer and use it in GitHub Desktop.
Compare props and nextProps in console.table
const props2table = (props, nextProps, list) =>
Object.assign({}, ...Object.keys(props)
.filter(e => list.includes(e))
// .filter(e => props[e] !== nextProps[e])
.map(k => ({[k]: {props: props[k], nextProps: nextProps[k]}}))
);
console.table(props2table(this.props, nextProps, ['value']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment