English 中文(简体)
如何将反应-image-galley的每一个图像变成一个可点击的链接?
原标题:How to turn each image in react-image-galley into a clickable link?
  • 时间:2024-01-20 01:46:40
  •  标签:
  • reactjs

我正在使用反应力气,显示不同的商品,我希望在座标上的每一形象都能被点击,把我带上自己在第三方网站上的产品页。 我从第三方网站APIC(现在我刚刚使用假数据)检索了商品信息,我应该从APIC中获取这一功能。 我的守则是:

export default function MerchPreview() {
  const [gallery, setGallery] = useState([])

  useEffect(() => {
    const formattedProducts = testMerchData.results.map(product => (
      {
        originalTitle: product.name,
        description: product.description,
        original: product.images[0].url,
        thumbnail: product.images[0].url,
        slug: product.slug
      }
    ))

    setGallery(formattedProducts)
  }, [])

  return (
    <div className= MerchPreview >
      <ProductGallery 
        items={gallery}
      />
    </div>
  )
}

页: 1 无论过去还是现在,但我的不耐烦使我无法知道哪里甚至开始。 ...... 项目看好我可能需要做些什么,但我需要做些什么。 很难再接下去,我不知道如何执行。 我认为,我试图做些什么可能是多余的。 希望得到任何帮助。

问题回答




相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签