I am serving cloudinary images responsively following this documentation:
My index.hjs looks like this:
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-
core/2.3.0/cloudinary-core-shrinkwrap.js" type="text/javascript">
</script>
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="/static/bundle.js"></script>
<script type="text/javascript">
var cl = cloudinary.Cloudinary.new({cloud_name: "myCloudName"});
cl.responsive();
</script>
</body>
Component rendering images has this per the above documentation:
{this.state.images.map(function(image, i){
return <img key={i} className="cld-responsive thumbnail"
data-src={image.albums.images}/>})}
the problem is on the initial render, the images render as 100% width with 0 height and don't appear at all. However, if I resize the window the responsive images are shown.
Do I need to move the
cl.responsive();
to somewhere else in my code? I tried moving it into the component and triggering a state refresh with componentDidMount() but the images still don't show on re-render; only if the window is resized.
Any help is appreciated.