Skip to content
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

Prop-type rule doesn't work in getInitialState #41

Closed
tleunen opened this issue Mar 29, 2015 · 0 comments
Closed

Prop-type rule doesn't work in getInitialState #41

tleunen opened this issue Mar 29, 2015 · 0 comments

Comments

@tleunen
Copy link

tleunen commented Mar 29, 2015

I've noticed the rule doesn't work when the props are used in getInitialState.
Here is a test case:

var React = require('react');
React.createClass({
    propTypes: {
        initialValue: React.PropTypes.number
    },

    getDefaultProps: function() {
        return {
            initialValue: 0
        };
    },

    getInitialState: function() {
        return {
            value: this.props.initialValue
        };
    },

    render: function() {
        return null;
    }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants