import React from 'react'; export default class Mario extends React.Component { componentWillMount(){ console.log("Component will mount"); //if you set this.setState({}) here, it will set the state before the first render } componentDidMount() { console.log("Component did mount"); } componentWillReceiveProps(nextProps) { console.log(`Component will receive as next props: ${nextProps}`); } shouldComponentUpdate(nextProps,nextState) { console.log(`Should the comp update, it should update with ${nextProps} and/or ${nextState}`); return true; //answer if it should/should not update } componentWillUpdate render() { return () } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter