O'Reilly logo

ReactJS by Example - Building Modern Web Applications with React by Prathamesh Sonpatki, Vipul A M

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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'); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required