Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试渲染图像,每个图像都应该是可点击的。我试着在下面写一个代码。但是,当用户访问组件时会触发单击事件。你能解释为什么会这样吗?
我写的代码在这里
当我使用回调函数时,它成功了!
事件={{点击:() => this.props.addToCart(item.product_id)}}