Reusable Gatsby-Image Component with dynamic image sources

后端 未结 3 582
谎友^
谎友^ 2020-12-14 06:51

I’m thinking of using Gatsby-Image for my next project and has been playing around with it a little.

I got it to work on my test project but then I came up with a u

3条回答
  •  旧时难觅i
    2020-12-14 07:46

    Unfortunately from what I can gather the best solution is to write out individual js files for images.

    In @RodrigoLeon's approach, it will cause bundle size to increase DRAMATICALLY. Especially if say you have more than 50 images. Because anytime you use this and loop through all images you create references to them in the component file. So I would not recommend doing it this way.

提交回复
热议问题