Created
May 17, 2016 17:28
-
-
Save iamdustan/040c93095484e7a9cbb6e739b61e5186 to your computer and use it in GitHub Desktop.
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
| /* @flow */ | |
| const React = require('react'); | |
| const ReactDOM = require('react-dom'); | |
| const {Component, PropTypes} = React; | |
| type Props = typeof MyComponent.propTypes; | |
| class MyComponent extends Component { | |
| props: Props; | |
| constructor(props:Props) { | |
| super(props); | |
| } | |
| render() { | |
| return ( | |
| <div>{this.props.name}</div> | |
| ); | |
| } | |
| } | |
| MyComponent.propTypes = { | |
| name: PropTypes.string.isRequired, | |
| hello: PropTypes.func, | |
| }; | |
| ReactDOM.render( | |
| <MyComponent name={5} hello={() => 'world'} />, | |
| document.body | |
| ); | |
| module.exports = MyComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment