我有一个这样的代码,我想改变标签名称开始〈所有。
{services.map((item) => (
<div className="space-x-[8px] py-[8px] flex ">
<div className="flex flex-col text-center relative px-[8px] py-[8px] items-center active:bg-[#f5f5f5] cursor-pointer">
<All.${item}
sx={{ fontSize: "40px" }}
className="text-[#6B84DD] w-[64px] h-[p64x] text-3xl"
/>
<span className=" font-merrisans text-[14px] font-semibold">
{item}
</span>
</div>
</div>
))}
我试过这样
{services.map((item) => (
<div className="space-x-[8px] py-[8px] flex ">
<div className="flex flex-col text-center relative px-[8px] py-[8px] items-center active:bg-[#f5f5f5] cursor-pointer">
{(`{<All.${item}
sx={{ fontSize: "40px" }}
className="text-[#6B84DD] w-[64px] h-[p64x] text-3xl"
/>`)}
<span className=" font-merrisans text-[14px] font-semibold">
{item}
</span>
</div>
</div>
))}
但它不工作它显示
1条答案
按热度按时间py49o6xq1#
JSX不是字符串,不能使用
${}