Component life cycle methods

"Shawn, let's start with an exhaustive example that triggers these methods." Mike informed.

console.log('Start') // Marks entry point of JS code. var App = React.createClass({ componentWillMount: function(){ console.log('componentWillMount'); }, componentDidMount: function(){ console.log('componentDidMount'); }, getInitialState: function(){ return { status: true} }, getDefaultProps: function(){ return {name: 'John'}; }, componentWillReceiveProps: function(nextProps){ console.log('componentWillReceiveProps'); }, shouldComponentUpdate: function(nextProps, nextState){ console.log('shouldComponentUpdate'); return true; }, componentWillUpdate: function(){ console.log('componentWillUpdate'); }, render: function() { console.log('render'); ...

Get ReactJS by Example - Building Modern Web Applications with React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.