Skip to content

no-unused-props unable to handle inline functions #1309

Closed
@Robinfr

Description

When you do the following, no-unused-props is triggered even though the props are used:

const Thing = (props) => (
    <div>
        {(() => {
            if(props.enabled){
                return (
                    <span>Enabled!</span>
                )
            }
            
            return (
                <span>Disabled..</span>
            )
        })()}
    </div>
);

Thing.propTypes = {
    enabled: React.PropTypes.bool
};

Thing.defaultProps = {
    enabled: false
};

export default Thing;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions