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

Rule proposal (for 0.14): require stateless function components use destructuring on the props parameter #216

Closed
jimbolla opened this Issue Sep 13, 2015 · 0 comments

Comments

3 participants
@jimbolla

jimbolla commented Sep 13, 2015

It would warn on this:

    var SomeThing = props => (
        <Foo bar={props.fizz} baz={props.buzz} />
    );

Suggesting that this is a more expressive syntax:

    var SomeThing = ({fizz, buzz}) => (
        <Foo bar={fizz} baz={buzz} />
    );

An exception where props would be ok is if it's just being passed wholesale to an inner component via spread operator. This would be consider valid:

    var SomeThing = props => (
        <Wrapper>
            <Foo someDefault="blah" {...props} />
        </Wrapper>

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