[英]React: router link with param not working
My problem is passing ${file.id} to link, but when I navigate to that link, I only receive like this: 我的问题是将$ {file.id}传递给链接,但是当我导航到该链接时,只会收到如下内容:
the ${file.id} is not get correct value. $ {file.id}的值不正确。 But when I inspect the key of row, it can render correct. 但是,当我检查row键时,它可以呈现正确的图像。
Thanks 谢谢
You are using the wrong quotes. 您使用了错误的引号。 String interpolation is not possible with single quotes or doublequotes. 单引号或双引号不能进行字符串插值。 You have to use the backtick ` 您必须使用反引号`
So 所以
<Link to={'api/admin/blobManager/${file.id}'} />
should instead be 相反应该是
<Link to={`api/admin/blobManager/${file.id}`} />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.