Created
January 28, 2021 07:37
-
-
Save decpk/1cc693db112f0185c599faa894090ca4 to your computer and use it in GitHub Desktop.
Initial state in React Before ES6
This file contains hidden or 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
| const React = require( 'react' ); | |
| const CreateReactClass = require( 'create-react-class' ); | |
| const App = CreateReactClass( { | |
| getInitialState() { | |
| return { | |
| message: 'world' | |
| } | |
| }, | |
| render() { | |
| return React.createElement( 'h1', null, `Hello ${this.state.message}` ); | |
| } | |
| } ) | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment