Created
January 28, 2021 07:53
-
-
Save decpk/7c6f5a900edfd00280d675059140ae9c to your computer and use it in GitHub Desktop.
Default props in ES6 classes
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, { Component } from 'react'; | |
| import App from './App'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <h1>Hello {this.props.message}</h1> | |
| ); | |
| } | |
| } | |
| App.defaultProps = { | |
| message: 'world from default props' | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment