Skip to content

Instantly share code, notes, and snippets.

MERN

  • npm install express --save

  • npm install body-parser cookie-parser multer --save

  • npm install -g devtool

  • devtool app.js --watch

Closure and Const/Let

_createClass(Contact, [{
	    key: 'render',
	    value: function render() {
	      var self = this;
	      var controls = [];
	
	      var _loop = function _loop() {

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.