Skip to content

Instantly share code, notes, and snippets.

View dorklord23's full-sized avatar
🏠
Working from home

Tri R.A. Wibowo dorklord23

🏠
Working from home
View GitHub Profile
@dorklord23
dorklord23 / debug.js
Created June 28, 2019 14:26
Ultimate debugging function to find out why a component seemingly re-renders itself in React
function compare(currentProps, prevProps) {
Object.keys(currentProps).forEach(key => {
if (currentProps[key] !== prevProps[key]) {
console.log(key, "changed from", prevProps[key], "to", currentProps[key]);
}
})
}