I was wondering whether there is a way to suppress rendering the width and height attributes when using the Image
component from @sitecore-jss/sitecore-jss-react
? Or under the hood, it basically uses the standard Sitecore Field Renderer so not really? It ends up distorting our design.
At the moment we are using this as a workaround:
{isExperienceEditorActive() ? (
<Image media={fields.Image} />
) : (
<img src={fields.Image.value.src} alt={fields.Image.value.alt}></img>
)}
— but that means it still looks distorted in Experience Editor.
I suppose the other option would be to try to strip them out from DOM but I think that might cause flickering & generally seems like not a very elegant solution.