Recommend exporting propTypes as a named export

By exporting `propTypes` as a named export *as well* as attaching them to the "class", they can be explicitly imported by tests and other components in a way that aligns with the future ES6 module dependency graph, rather than as an arbitrary property that isn't statically verifiable. Doing both is great imo.

Thoughts?
This commit is contained in:
Jordan Harband
2015-08-17 20:42:58 -07:00
parent 909fc8b5d7
commit c4fdbc2742

View File

@@ -262,7 +262,7 @@
```javascript
import React, { Component, PropTypes } from 'react';
const propTypes = {
export const propTypes = {
id: PropTypes.number.isRequired,
url: PropTypes.string.isRequired,
text: PropTypes.string,