Skip to content

Instantly share code, notes, and snippets.

@sagar-gavhane
Created October 10, 2018 17:00
Show Gist options
  • Save sagar-gavhane/2a5ad54bb079f4b8d30a9333d516362c to your computer and use it in GitHub Desktop.
Save sagar-gavhane/2a5ad54bb079f4b8d30a9333d516362c to your computer and use it in GitHub Desktop.
prop types and default props types inside <App /> components.
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