是否可以在 React 的输入标签中有条件地仅呈现占位符属性?

Is it possible to conditionally render only the placeholder attribute in a input tag in React?

我想做如下事情:

        return (
          <input  
            {(tagsArrayEmpty) ? placeholder='enter your tags' : placeholder='empty'}
            type="text"
          />
        )

但我收到错误:解析错误:意外标记,应为“...”

是否可以有条件地只呈现输入标签的占位符部分而不是完整的输入标签?我阅读了 conditional rendering here 的文档,但所有示例至少只呈现完整标签。只是想知道有没有办法。

当然,像这样:

       return (
          <input  
            placeholder={tagsArrayEmpty ? 'enter your tags' : 'empty'}
            type="text"
          />
        )