Skip to content

Instantly share code, notes, and snippets.

View itsmeganesh-cse-iiit's full-sized avatar

Ganesh itsmeganesh-cse-iiit

View GitHub Profile
@itsmeganesh-cse-iiit
itsmeganesh-cse-iiit / jshipster_and_and.js
Created November 28, 2019 07:23 — forked from berzniz/jshipster_and_and.js
Some small javascript hacks for hipsters
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props