mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-22 17:48:05 -05:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user