Skip to content

Instantly share code, notes, and snippets.

@sjotterman
sjotterman / whyUpdate.js
Created November 20, 2019 22:16
Why did a React component update?
componentDidUpdate(prevProps, prevState) {
Object.entries(this.props).forEach(
([key, val]) => prevProps[key] !== val && console.log(`Prop '${key}' changed`)
);
if (this.state) {
Object.entries(this.state).forEach(
([key, val]) => prevState[key] !== val && console.log(`State '${key}' changed`)
);
}
}
@sjotterman
sjotterman / keybindings.json
Created April 26, 2018 14:00
Visual Studio Code keybindings
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+alt+r", "command": "workbench.action.gotoSymbol" },
{ "key": "ctrl+l", "command": "workbench.action.focusNextGroup" },
{ "key": "ctrl+h", "command": "workbench.action.focusPreviousGroup" },
{ "key": "ctrl+0", "command": "workbench.action.focusSideBar" },
{
"key": "ctrl+k",
"command": "workbench.action.toggleSidebarVisibility"