reactjs - 反应:使用图像作为链接
问题描述
如何在反应中使图像可点击,我尝试了这两种方法
第一个根本不起作用
{ this.state.posts.map((post) => {
return (
<div class="col-md-6 col-6 padding animate-box" data-animate-effect="fadeIn">
<div class="fh5co_suceefh5co_height_2">
<Link to={`/Post/${post.id}`}>
<img src={post.image} />
</Link>
</div>
至于这个,我显然需要从 react-native 导入 {image} 但是当我安装 react native 时出现此错误:
错误./node_modules/react-native/index.js
react-native 模块解析失败
{ this.state.posts.map((post) => {
return (
<div class="col-md-6 col-6 paddding animate-box" data-animate-effect="fadeIn">
<div class="fh5co_suceefh5co_height_2">
<Link to={`/Post/${post.id}`}>
<Image src={post.image} />
</Link>
</div>
解决方案
推荐阅读
- c# - 使用带有 RestSharp C# 的 Mailgun API 发送 HTML 电子邮件,导致消息在包含时在与号“&”处被截断
- ruby - 如何使用循环将项目推送到 ruby 数组
- java - 相同的应用程序部署在两个不同的服务器上,但从数据库中获取相同的数据。如何同步数据库数据
- python - 如何从列表中创建 2 列的数据框?
- django - 在 django 中添加到 manytomany 字段时捕获异常
- sql - 使用 HAVING 查找重复项
- magento - 如果选择印度货币,则在账单地址的国家/地区列表中仅显示“印度”
- algorithm - 复杂度最好的寻路算法是什么?
- java - java.lang.IllegalArgumentException:这个源已经添加了不同的观察者
- java - 具有自己的数据库用户详细信息的云端点的自定义身份验证