-
-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Labels
Description
With the new push for ES6 class syntax over the now-deprecated React.createClass(), this issue has become a little bit more relevant. ES6 classes don't (yet) support static data members without a MyClass.myProp = ...
outside of the main class definition. They do, however, support static getters, but that would mean returning something like propTypes
from a function.
For example:
class MyComponent extends React.Component {
static get propTypes() {
return {
...
}
}
}
vs.
class MyComponent extends React.Component {
}
MyComponent.propTypes = {
...
}
It's not essential, but it would be really nice to be able to declare propTypes inside the ES6 class body and still have them be detected by react-docgen.
Issue created by recommendation of @fkling in the discussion on #151
ycmjason, Nikx, kcjonson, jesseko and prameshbajra