Skip to content

props => props.borderRadius should not trigger react/destructuring-assignment  #1637

Closed
@dexteryy

Description

@dexteryy

props => <div id={props.id} /> should be considered to a stateless component, props => props.borderRadius should not

For example:

import styled from 'react-emotion'

const ButtonWrapperDiv = styled.div`
  & .s-common-button {
    border-radius: ${props => props.borderRadius}px;
    background: ${props => props.backgroundColor};
    color: ${props => props.textColor};
    &:hover {
      background: ${props => props.hoverBackgroundColor};
    }
  }

BTW, it's better to provide an option to allow one line stateless component to use props directly.

For example:

const ComonentA = props => <div id={props.id} />

or

function ComonentA(props) { return <div id={props.id} /> }

Otherwise it will be too complicated:

const ComonentA = props => { const { id } = props; return <div id={id} /> }

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