reactjs - 如何根据我的链接地址添加字母?在反应
问题描述
如果我点击链接,我希望在文本旁边添加“#”符号。(例如“FUN”<--如果点击这个链接,在那个文本之后改变这个-->“#FUN”)我如何实现它?帮助我的天才这是我的jsx代码
// styled-components
const ShapScroll = styled.div``;
const ShapTexts = styled.div`
font-size: 20px;
width: fit-content;
`;
const ShapText = styled.span`
margin-right: 14px;
border-bottom: 2px solid
${(props) => (props.current ? "#191919" : "transparent")};
transition: border-bottom 0.3s ease-in-out;
`;
// react return
<ShapTexts>
<ShapScroll>
<ShapText
current={pathname === "/covid19"}
>
<ShapLinks to="/covid19">코로나19</ShapLinks>
</ShapText>
<ShapText current={pathname === "/news"}>
<ShapLinks to="/news">뉴스</ShapLinks>
</ShapText>
.
.
.
<ShapText
current={pathname === "/sports"}}
>
<ShapLinks to="/sports">스포츠</ShapLinks>
</ShapText>
</ShapScroll>
</ShapTexts>
解决方案
推荐阅读
- c++ - LMDB 是否支持随机读取?
- ios - 是否有任何适当的方法可以在堆栈视图中填充相同的标签?
- nginx - 如何以 JSON 格式而不是其默认的日志记录格式制作 nginx 错误日志?
- xml - Oracle XML 表导出对象类型未给出
- java - 使用自定义 bean 测试 PreAuthorize 注释
- angular - Angular 反应式输入控件中不同模型和视图值的简单解决方案
- c# - 通过 Excel Interop 使用参数打开 VBA 文件 excel
- php - 如何在 WooCommerce 管理员订单列表上创建过滤器下拉列表?
- python - 如何合并 CSV 文件?
- html - 有条件的红宝石如何只显示一次而不重复