Created
October 10, 2018 17:00
-
-
Save sagar-gavhane/2a5ad54bb079f4b8d30a9333d516362c to your computer and use it in GitHub Desktop.
prop types and default props types inside <App /> components.
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 App extends Component { | |
static propTypes = { | |
title: propTypes.string, | |
}; | |
static defaultProps = { | |
title: 'app works from default props', | |
} | |
render() { | |
return ( | |
<React.Fragment> | |
<h1>{this.props.title}</h1> | |
</React.Fragment> | |
); | |
} | |
} | |
ReactDOM.render(<App title="app works!!" />, document.getElementById("root")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment