compiled icon indicating copy to clipboard operation
compiled copied to clipboard

Commented expression still being applied

Open pancaspe87 opened this issue 3 years ago • 0 comments

When commenting an independent condition expression, styles are still applied

const Component = styled.div`
  /*${({ isRed }) => isRed ? 'color: red' : 'color: green'};*/
`;

// Outputs
const _2 = "._syazbf54{color:green}";
const _ = "._syaz5scu{color:red}";

const Component = forwardRef(
  ({ as: C = "fieldset", style, isRed, ...props }, ref) => (
    <CC>
      <CS>{[_, _2]}</CS>
      <C
        {...props}
        style={style}
        ref={ref}
        className={ax(["", isRed ? "_syaz5scu" : "_syazbf54", props.className])}
      />
    </CC>
  )
);

However using these commented expressions are fine

const Component = styled.div`
  /*color: ${({ isRed }) => isRed ? 'red' : 'green'};*/
  /*${inline};*/
`;

pancaspe87 avatar Feb 16 '22 23:02 pancaspe87