javascript - javascript template litreral in side a react link tag to={} attribute
问题描述
<Link to={'${oldUrl}/${id}'} >
Hi, I am using template literal in a react app link tag and it is showing below error message please tell if anyone knows how to add it correctly?
Unexpected template string expression no-template-curly-in-string
解决方案
将您的代码更改为此
<Link to={`${oldUrl}/${id}`} >
它应该清除错误
推荐阅读
- sitecore - Sitecore 丢失了添加到 FullDescription 和 Description 字段的 br 标签
- python - 如何让对象被他的创造者改变
- angular - 在角度服务中读取 url 参数是一种好习惯吗?
- asp.net - 在按钮单击期间强制应用可见属性
- laravel - 即使我的 php 是 7.2,我也无法安装 laravel 6
- tensorflow2.0 - Tensorflow Federated:为什么我的迭代过程无法训练回合
- javascript - Vue每秒更新dom,简单时钟
- javascript - Scrapy 只抓取前两页
- sql - 使用 dd/mm/yyyy 格式的日期访问 vba sql 查询
- sql - 每 6 个月动态拆分日期范围。开始日期可以是任何东西,但加起来是月份范围