Created
November 22, 2019 02:34
-
-
Save vereperrot/0bc7b02950141a046815dd93cb1f3425 to your computer and use it in GitHub Desktop.
react-state-example.js
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
class Car extends React.Component { | |
constructor() { | |
super(); | |
this.state = {color: "red"}; | |
} | |
render() { | |
return <h2>I am a {this.state.color} Car!</h2>; | |
} | |
} | |
ReactDOM.render(<Car />, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment