【发布时间】:2021-05-27 08:26:03
【问题描述】:
我得到了这样的东西
<Box>
<SomethingA>
</Box
我想将Box.SomethingA 替换为Box.SomethingB
<Box>
<SomethingB>
</Box>
我该怎么做?
【问题讨论】:
-
导入 SomethingB 并在退货时替换它。
-
@Konstantin 但喜欢什么?
-
你想在特定条件下这样做吗?
-
@AnkitGarg
<SomethingA>是<svg>格式的世界地图。其中<svg>有一个<path> = Country。因此,例如,当用户单击名称为USA的<path>时,<SomethingA>将更改为<SomethingB,这等于另一个具有 美国地图的<svg>> -
试试下面的链接。这将帮助您实现您提到的场景。 reactjs.org/docs/conditional-rendering.html
标签: javascript reactjs webpack chakra-ui