Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须为片段设置一个属性。我想做这样的事情:
<className="name"> abcd </>
有什么办法可以这样做吗?
你不能,因为它是 React 特定的,而不是 HTML 标签。这是文档所说的:
您可以像使用任何其他元素一样使用 <></>,但它不支持键或属性。