render() method that mounts our entire application on DOM • We pass in the root Element and tell React where to mount our content • React begins processing the passed Element(s) and generate instances of our React components • This is the point where we enter the Component life cycle 3
time on initial component render • Can’t do anything involving the DOM • Shouldn’t initialize your configuration (we have constructor) • Can call setState. JUST DON’T - use default state 7
Don’t setState - will cause a re-render infinitely!! • Don’t access DOM element. Warning: setState(...): Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state. 9
Some data finally came to our component to mess our state! • We have access to both current props (this.props) and new props that came to our component! 13
do anything before I re-render?” • Same as componentWillReceiveProps, except you are not allowed to call setState If you are using shouldComponentUpdate AND need to do something when props change, componentWillUpdate makes sense. Eg. Dispatch events, animations 15