Created
January 28, 2021 07:46
-
-
Save decpk/acacdb6a6d18065cf1af941bbe9000b8 to your computer and use it in GitHub Desktop.
Default props 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( { | |
| getDefaultProps() { | |
| return { | |
| message: 'world' | |
| } | |
| }, | |
| render() { | |
| return React.createElement( 'h1', null, `Hello ${this.props.message}` ); | |
| } | |
| } ) | |
| export default App; |
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
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import App from './components/App'; | |
| import App2 from './components/App2'; | |
| ReactDOM.render( | |
| <App/>, | |
| document.querySelector( '#root' ) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment