Created
February 9, 2017 19:36
-
-
Save tjwebb/427e5157f1c8487511f21a5835cd48d5 to your computer and use it in GitHub Desktop.
React PropTypes ES6
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
// Okay: | |
const Foo = class Foo extends Component { | |
// ... | |
} | |
Foo.propTypes = { | |
// ... | |
} | |
export default Foo | |
// --------------- | |
// Better: | |
export default class Foo extends Component { | |
static get propTypes () { | |
return { | |
// ... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment