Skip to content

Instantly share code, notes, and snippets.

View iamakulov's full-sized avatar

Ivan Akulov iamakulov

View GitHub Profile

deepCompare performs a deep comparison of two objects. It automatically unwraps JS Maps, Sets, and ImmutableJS objects.

Example

deepCompare(left, right)

// Will output:
// {
// isEqual: false,
// A copy-pasteable useWhyDidYouUpdate hook, adopted from the old & good usehooks.com (http://web.archive.org/web/20230203011511/https://usehooks.com/useWhyDidYouUpdate/).
//
// This hook will log whenever a component rerenders – and will print the props (or any other values
// you passed into it) that have changed between the rerenders.
//
// Usage:
//
// function MyComponent(props) {
// useWhyDidYouUpdate('MyComponent', props)
//