2

Can someone help with the TypeScript error:

Property 'srcset' does not exist on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'.

I can't figure out what is going wrong. I also tried this solution, but no result:

declare global {
  namespace JSX {
      interface IntrinsicElements {
        srcset: React.DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>
      }
  }
}
Max Travis
  • 1,228
  • 4
  • 18
  • 41

1 Answers1

7

The solution is to use srcSet instead of srcset -> Why is React.js removing the srcset tag on <img />?

Max Travis
  • 1,228
  • 4
  • 18
  • 41