[英]React prop is not rendering link
The following prop I am trying to pass is not clickable/directing to the specified link. 我尝试传递的以下道具无法点击/定向到指定的链接。 I have created a JSON file separately. 我已经分别创建了一个JSON文件。 Below is my react component 以下是我的反应成分
<div className="card-action">
<a href="#{project.link}">View me on Github</a>
</div>
this is what I have included in my JSON file 这就是我包含在JSON文件中的内容
"link": "https://github.com/wyncode/joshua_matthew_michaela_nicole"
If you want to render value of your prop, you need to put it in '{}' and not in double quotes. 如果要呈现道具的价值,则需要将其放在“ {}”中,而不要用双引号引起来。
Try this (and as your link in your json data is full url, the anchor '#' is useless here): 尝试一下(由于json数据中的链接为完整url,因此锚点'#'在这里没有用):
<a href={project.link}>View me on Github</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.