-
Notifications
You must be signed in to change notification settings - Fork 46.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getDefaultProps not working #3655
Comments
Es6 classes need defaultProps as a static property. Navigation.defaultProps = {...} |
Thanks. Maybe update this in documentation :) ? @iamdustan I will be happy to send in a PR |
#3647 has some commentary on docs and es6. I agree that I’d like to see better docs on the class syntax. I’m just a guy who happened to see your issue really quickly :) |
http://facebook.github.io/react/docs/reusable-components.html#es6-classes does reference this. It might be good to also put some documentation in http://facebook.github.io/react/docs/component-specs.html#getdefaultprops to make it a bit easier to find. I'm going to close this out since it's invalid but I'd love to see a PR with more docs :) |
I think you should have also seen a runtime warning for this? |
@spicyj not really, though |
@tjwudi Thanks, looks like an oversight. Fix incoming… |
Add warning for getDefaultProps on ES6 classes
Add warning for getDefaultProps on ES6 classes
Add warning for getDefaultProps on ES6 classes
Add warning for getDefaultProps on ES6 classes
I am working on a very simple component with default props.
And I simply render it without any props (
<Navigation />
). But I got an empty object from console output.I am using react 0.13.1, chrome 41, OSX 10.10.
Any idea what is going wrong?
The text was updated successfully, but these errors were encountered: