Skip to content

Rule idea: no spreading props #1094

Closed
Closed
@mockdeep

Description

@mockdeep

One thing we've noticed tends to make code a little opaque is when we destructure the entire props for a sub-component:

function MyComponent(props) {
  return <MySubComponent {...props} />
}

It would be great to have an eslint rule to force expanding individual props that should be passed down:

function MyComponent(props) {
  return <MySubComponent one_prop={props.one_prop} two_prop={props.two_prop} />
}

Metadata

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