Skip to content

Instantly share code, notes, and snippets.

  • npm install express

  • npm install -g node-inspector

  • npm install -g devtool

  • devtool app.js --watch

  • npm install mongodb

  • An NPM module could be loaded from either dist or lib folder. It is defined in the package.json file "main".
  • Change made directly to lib or dist folder will cause the wrong lines in debugger.
  • Example to build the dependencies
  1. Download draft-js-export-html-master
  2. Run "npm install".
  3. Change the source code
  4. Run "npm run build" to build the code to lib folder.
  5. Download react-rte

React Performance

Immutable.js

To summarize, the performance managment of React is about using shouldComponentUpdate with "Deep Change" and "Shallow Change" of state object.

First, when implementing shouldComponentUpdate, we always want to do shallow comparason only, since deep comparason is expensive.

Second, based on the first assumption, when we do "Deep Change" for example when we change an array in place using array push, pop, splice ... or change an object property value, the state objecct's reference never change and since the shouldComponentUpdate will be blind to these changes and thus it will always return false.