Skip to content

Instantly share code, notes, and snippets.

View andrewrota's full-sized avatar

Andrew Rota andrewrota

View GitHub Profile
@andrewrota
andrewrota / react-lifecycle-cheatsheet.md
Last active April 19, 2017 11:47 — forked from bvaughn/react-lifecycle-cheatsheet.md
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 SSR Example uses
Mounting
constructor Called before it is mounted
componentWillMount :/ Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
$(document).ready(function() {
$('body').prepend('<div id="console" class="alert alert-warning">');
var $console = $('#console');
$console.css('font-family', 'monospace');
$console.hide();
console = {
log: function (text) {
$console.show();
$console.append('<p>' + text + '</p>');
},