Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Created May 17, 2016 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdustan/040c93095484e7a9cbb6e739b61e5186 to your computer and use it in GitHub Desktop.
Save iamdustan/040c93095484e7a9cbb6e739b61e5186 to your computer and use it in GitHub Desktop.
/* @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