组件中的三元运算符将 prop 传递给样式化的组件?

Ternirary operator in compoennt to pass prop to styled component?

我有一个布尔变量 isHere,它需要为组件定义一些额外的样式。如果我使用 className 则传递道具:

  <Item className={isHere ? 'hi' : null}>
    // Stuff
  </Item>

然而,当我尝试传递样式化组件的 prop 时,出现错误:

    <Item {isHere ? {joined: true} : null}>
      // Stuff
    </Item>

Syntax error: Unexpected token, expected ... (30:15)

  <Item joined={isHere ? true : false}>
    // stuff 
  <LeaveLocation />