Why is React.js removing the srcset tag on ?

后端 未结 3 1084
南方客
南方客 2021-01-03 21:25

When I have the srcset property on my tag, why doesn\'t it show up in the browser? It appears as through React.js is stripping it out

3条回答
  •  臣服心动
    2021-01-03 22:13

    Tried to use srcSet with a string didn't work for me probably because how Webpack works so in the end, imported them and include them with the template string as in the next example:

    import nat1 from "./img/nat-1.jpg";
    import nat1Large from "./img/nat-1-large.jpg";
    import nat2 from "./img/nat-2.jpg";
    import nat2Large from "./img/nat-2-large.jpg";
    import nat3 from "./img/nat-3.jpg";
    import nat3Large from "./img/nat-3-large.jpg";
    
    
      
    Photo 1 Photo 2 Photo 3

提交回复
热议问题