Created
September 25, 2018 19:42
-
-
Save mahdiyazdani/ad705b5a416da79499222c3a96a78301 to your computer and use it in GitHub Desktop.
componentDidMount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
export class Flashy extends React.Component { | |
componentWillMount() { | |
alert('AND NOW, FOR THE FIRST TIME EVER... FLASHY!!!!'); | |
} | |
componentDidMount() { | |
alert('YOU JUST WITNESSED THE DEBUT OF... FLASHY!!!!!!!'); | |
} | |
render() { | |
alert('Flashy is rendering!'); | |
return ( | |
<h1 style={{ color: this.props.color }}> | |
OOH LA LA LOOK AT ME I AM THE FLASHIEST | |
</h1> | |
); | |
} | |
} | |
ReactDOM.render( | |
<Flashy color='red' />, | |
document.getElementById('app') | |
); | |
setTimeout(() => { | |
ReactDOM.render( | |
<Flashy color='green' />, | |
document.getElementById('app') | |
); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment