Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Last active May 21, 2018 10:37
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jcreamer898/aeaf4b7a08b9871c3a48ad4bb7ccb35c to your computer and use it in GitHub Desktop.
Save jcreamer898/aeaf4b7a08b9871c3a48ad4bb7ccb35c to your computer and use it in GitHub Desktop.
Name of thing Sorta like... Mounted? Can you even setState? What would you say... ya do here?
constructor initialize() nope nope init stuff NO side effects
componentWillMount beforeDomReady() nope yeah but don't Only needed in createClass now use constructor for most things
render render nope please no render stuff and don't set any state please
componentDidMount domReady() yup yup DOM is a go init jQuery plugins dispatch stuff
componentWillReceiveProps onChange() yup yup Props changed feel free to update state if needed
componentWillUpdate beforeRender() yup nope The props or state changed need to do anything else before rendering?
shouldComponentUpdate shouldRender() yup nope So yeah something changed but do we REALLY need to update?
componentDidUpdate afterRender() yup yup Great success we've rendered a thing... anything else?
componentWillUnmount destroy() too late too late Only you can prevent memory leaks aka unbind things
@coreyar
Copy link

coreyar commented Feb 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment