{"id":27922,"date":"2023-08-11T07:00:00","date_gmt":"2023-08-11T14:00:00","guid":{"rendered":"http:\/\/Create-React-Image-Component"},"modified":"2025-11-27T11:58:00","modified_gmt":"2025-11-27T19:58:00","slug":"create-react-image-component","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/create-react-image-component","title":{"rendered":"Create a Responsive React Image Component With Cloudinary-React SDKs"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>Images are an important part of the web, so delivering the right image for the right device at the right time while maintaining optimized quality is very important.<\/p>\n<p>In this article, we\u2019ll go over a few techniques using Cloudinary-React SDK v2 and JavaScript SDK v2 to apply transformations to our images.<\/p>\n<p>Here\u2019s a link to the demo on <a href=\"https:\/\/codesandbox.io\/s\/responsive-image-cloudinary-react-t90g6\">CodeSandbox<\/a>.<\/p>\n<\/div>\n\n\n  <div class=\"wp-block-cloudinary-code-sandbox \">\n    <iframe\n      src=\"https:\/\/codesandbox.io\/embed\/responsive-image-cloudinary-react-t90g6?theme=dark&amp;codemirror=1&amp;highlights=&amp;editorsize=50&amp;fontsize=14&amp;expanddevtools=0&amp;hidedevtools=0&amp;eslint=0&amp;forcerefresh=0&amp;hidenavigation=0&amp;initialpath=%2F&amp;module=&amp;moduleview=0&amp;previewwindow=&amp;view=&amp;runonclick=1\"\n      height=\"500\"\n      style=\"width: 100%;\"\n      title=\"responsive-image-cloudinary-react-t90g6g\"\n      loading=\"lazy\"\n      allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\"\n      sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n    ><\/iframe>\n  <\/div>\n\n\n<div class=\"wp-block-cloudinary-markdown \"><h2>Creating a Cloudinary Account<\/h2>\n<p>If you don\u2019t have a Cloudinary account yet, you can <a href=\"https:\/\/cloudinary.com\/users\/register_free\">sign up<\/a> for a free account. Log in after creating your account, and on your dashboard page, you should see all your credentials (cloud name, etc.) We\u2019re only interested in the cloud name since that\u2019s what we\u2019ll need in our React application.<\/p>\n<h2>Setting Up Your Project<\/h2>\n<p>Open your terminal and run the following command to bootstrap a React app with <a href=\"https:\/\/create-react-app.dev\/\">CRA<\/a> (<code>create-react-app<\/code>) template in a folder called <code>my-project<\/code>.<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">    npx create-react-app my-project\n<\/code><\/span><\/pre>\n<p>The next step is to install the dependencies that we\u2019ll need in this project. Run the following command to install them.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\">    <span class=\"hljs-selector-tag\">npm<\/span> <span class=\"hljs-selector-tag\">install<\/span> <span class=\"hljs-keyword\">@cloudinary<\/span>\/url-gen @cloudinary\/react --save\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>We\u2019ll install the Cloudinary SDKs for our React application. The <code>@Cloudinary\/url-gen<\/code> package is used to configure Cloudinary, create delivery URLs for our images, and apply transformations. The transformed images will be passed as an input to the component provided by the <code>@cloudinary\/react<\/code> package, which will render the media on our site.<\/p>\n<h2>Transforming Assets<\/h2>\n<p>Cloudinary provides us with different methods to apply transformations to our assets. We\u2019ll use the URL of a remote image on the web.<\/p>\n<p>Open your <code>App.js<\/code> file and add the following to it.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> { Cloudinary } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/url-gen\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { AdvancedImage } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/react\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { fill } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/url-gen\/actions\/resize\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { Effect } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/url-gen\/actions\/effect\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { byRadius } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/url-gen\/actions\/roundCorners\"<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> { byAngle } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"@cloudinary\/url-gen\/actions\/rotate\"<\/span>;\n    <span class=\"hljs-keyword\">const<\/span> cld = <span class=\"hljs-keyword\">new<\/span> Cloudinary({\n      <span class=\"hljs-attr\">cloud<\/span>: {\n        <span class=\"hljs-attr\">cloudName<\/span>: <span class=\"hljs-string\">\"ifeomaimoh\"<\/span>\n      }\n    });\n    <span class=\"hljs-keyword\">const<\/span> App = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n      <span class=\"hljs-keyword\">const<\/span> file =\n        <span class=\"hljs-string\">\"https:\/\/images.pexels.com\/photos\/2246476\/pexels-photo-2246476.jpeg?auto=compress&amp;cs=tinysrgb&amp;dpr=2&amp;h=650&amp;w=940\"<\/span>;\n      <span class=\"hljs-keyword\">let<\/span> image = cld.image(file);\n      image = image.setDeliveryType(<span class=\"hljs-string\">\"fetch\"<\/span>);\n      image = image\n        .effect(Effect.sepia())\n        .resize(fill().height(<span class=\"hljs-number\">500<\/span>).width(<span class=\"hljs-number\">490<\/span>))\n        .roundCorners(byRadius().radius(<span class=\"hljs-number\">40<\/span>))\n        .rotate(byAngle(<span class=\"hljs-number\">20<\/span>));\n    \n      <span class=\"hljs-comment\">\/\/ This gives the full delivery URL of the tranformations applied above.<\/span>\n      <span class=\"hljs-built_in\">console<\/span>.log({ <span class=\"hljs-attr\">url<\/span>: image.toURL() });\n    \n      <span class=\"hljs-keyword\">return<\/span> (\n        <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">{{<\/span> <span class=\"hljs-attr\">padding:<\/span> \"<span class=\"hljs-attr\">5rem<\/span>\" }}&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">{{<\/span> <span class=\"hljs-attr\">marginBottom:<\/span> \"<span class=\"hljs-attr\">50rem<\/span>\" }}&gt;<\/span>scroll to lazy load <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">AdvancedImage<\/span> <span class=\"hljs-attr\">cldImg<\/span>=<span class=\"hljs-string\">{image}<\/span> \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n      );\n    };\n    <span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> App;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the code snippet above, we\u2019ll import the <code>Cloudinary<\/code> class, the <code>AdvancedImage<\/code> React component, and some qualifiers that we\u2019ll use to build and transform our image URL. We\u2019ll start by configuring our Cloudinary instance with our cloud name. Inside the App component, we\u2019ll define and store the URL of a remote image in a variable called <code>file<\/code>, then  instantiate a <code>CloudinaryImage<\/code> object and pass the variable to it.<\/p>\n<p>We\u2019ll also specify how we want our image to be delivered. We\u2019ll set the delivery type to <code>fetch<\/code> for our remote image by calling the <code>setDeliveryType<\/code> method. We\u2019ll also transform our image using the transformation actions and qualifiers on the <code>CloudinaryImage<\/code> object. We\u2019ll apply the <code>sepia<\/code> effect to the image, resize it, add rounded corners, and rotate it.<\/p>\n<p><code>https:\/\/res.cloudinary.com\/&lt;cloud_name&gt;\/image\/&lt;delivery type&gt;\/&lt;transformations&gt;\/&lt;file&gt;<\/code><\/p>\n<p>From the format above, we can see where the transformation parameters live.<\/p>\n<blockquote>\n<p>The order in which you write transformations is important to get the desired effects.<\/p>\n<\/blockquote>\n<p>Finally, we\u2019ll pass the transformed image object to the <code>cldImg<\/code> attribute in the <code>AdvancedImage<\/code> component, which renders the image on our site. Open your terminal and start your application to see the transformed image.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764273135\/blog-Create_a_Responsive_React_Image_Component_With_Cloudinary-React_SDKs-1.webp\" alt=\"image of city skyline in sepia, rotated at an angle\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1319\" height=\"762\"\/><\/p>\n<p>Under the hood, the <code>AdvancedImage<\/code> component will fetch the image from the webserver where it\u2019s located and then apply the transformations we specified.<\/p>\n<h2>Optimizing Images<\/h2>\n<p>There are plugins provided by the Cloudinary React library that help optimize the way you render media on your site. Let\u2019s check out three of them, but let\u2019s first look at the quality transformation parameter.<\/p>\n<ul>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/react_integration\">Image Placeholders<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/react2_integration#lazy_loading\">Lazy Loading<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/react2_integration#responsive_images\">Responsive Images<\/a>\n<\/li>\n<\/ul>\n<p><strong>Quality Optimization<\/strong>\nThe quality transformation parameter enables us to choose the quality compression level for our images, with values ranging from 1 to 100. The lower the quality value, the more the file is compressed to smaller file size.<\/p>\n<p>Let\u2019s update our <code>App.js<\/code> file to include the following:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">     image = image\n        ...\n        ...\n        .rotate(byAngle(<span class=\"hljs-number\">20<\/span>))\n        .quality (<span class=\"hljs-string\">'q_40'<\/span>);\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>We\u2019ll add the quality transformation parameter <code>q_40<\/code> and specify that we want an image quality of <code>40<\/code>. The result is a compressed image with small size and good quality. For most images, specifying an optimal value is difficult If we seek to optimize our images while maintaining quality. Cloudinary also provides us with a quality transformation parameter <code>auto<\/code>, which delivers an image with an automatically determined level of quality. You can also set the default image quality level in the <strong>Upload Settings<\/strong> for your account.<\/p>\n<p>Below is the result of applying different quality values.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764273137\/blog-Create_a_Responsive_React_Image_Component_With_Cloudinary-React_SDKs-2.webp\" alt=\"3 different sizes of the same city skyline image after applying quality values\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1080\" height=\"814\"\/><\/p>\n<p>Other variants of the auto parameter include <code>q_auto:low<\/code>, <code>q:auto:best<\/code>, etc., each with different compression levels. <a href=\"https:\/\/cloudinary.com\/documentation\/image_optimization#how_to_optimize_image_quality\">See here for more options<\/a>.<\/p>\n<p><strong>Lazy Loading Images<\/strong>\nThis ensures that images are delayed and loaded only when they\u2019re visible in the viewport. Add the following plugins to the list of your imports.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">import<\/span> {Cloudinary} <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/url-gen'<\/span>;\n    <span class=\"hljs-keyword\">import<\/span> {\n      AdvancedImage,\n      lazyload,\n      responsive,\n      placeholder,\n    } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">'@cloudinary\/react'<\/span>;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Let\u2019s now update our <code>App<\/code> component to include the plugins we imported.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">const<\/span> App = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span>{\n    <span class=\"hljs-keyword\">const<\/span> image = ...\n    ....\n      return (\n        <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">{{paddingBottom:<\/span> '<span class=\"hljs-attr\">30rem<\/span>'}}&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1<\/span>&gt;<\/span>scroll to lazy load <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h1<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p<\/span> <span class=\"hljs-attr\">style<\/span>=<span class=\"hljs-string\">{{marginBottom:<\/span> '<span class=\"hljs-attr\">50rem<\/span>'}} \/&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">AdvancedImage<\/span>\n            <span class=\"hljs-attr\">cldImg<\/span>=<span class=\"hljs-string\">{image}<\/span>\n            <span class=\"hljs-attr\">plugins<\/span>=<span class=\"hljs-string\">{&#91;lazyload<\/span> ('<span class=\"hljs-attr\">0<\/span>', <span class=\"hljs-attr\">1<\/span>), <span class=\"hljs-attr\">placeholder<\/span> ('<span class=\"hljs-attr\">blur<\/span>')]}\n          \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n      );\n    }\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>In the code snippet above, we\u2019ll use the <code>lazyload<\/code> and <code>placeholder<\/code> plugin in the <code>AdvancedImage<\/code> component. The <code>lazyload<\/code> plugin uses the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/IntersectionObserver\">intersection observer API<\/a> under the hood to detect if a user scrolls near the image or iframe before loading it. We\u2019re saying we want our image loaded when it is 100% visible on the page. Lazy loading images helps conserve bandwidth for images that are not seen and reduce the time needed to load a page.<\/p>\n<p>We\u2019ll use the <code>placeholder<\/code> plugin to render a fallback image while the image is being loaded. The placeholder image loads quickly, and your page content won\u2019t jump around. Because we\u2019ve specified \u201cblur\u201d as our placeholder option,  we\u2019ll get a blurred version of the target image while waiting for the full quality image to be downloaded.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764273141\/blog-Create_a_Responsive_React_Image_Component_With_Cloudinary-React_SDKs-3.webp\" alt=\"GIF of lazy load\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"600\" height=\"295\"\/><\/p>\n<p><strong>Responsive Images<\/strong>\nInitially, we resized our image using the <code>resize<\/code> qualifier. Although this works, the dimension of the image will remain static as the viewport size changes. Cloudinary React library provides the <code>responsive()<\/code> plugin that we can use to resize our image based on the viewport size automatically.<\/p>\n<p>First, we\u2019ll need to remove the <code>resize<\/code> qualifier.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-comment\">\/\/ Remove this line of code.<\/span>\n    .resize(fill().height(<span class=\"hljs-number\">500<\/span>).width(<span class=\"hljs-number\">490<\/span>))\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Let\u2019s include the responsive plugin in our <code>App<\/code> component.<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    plugins={&#91;lazyload (<span class=\"hljs-string\">'0'<\/span>, <span class=\"hljs-number\">1<\/span>),responsive(<span class=\"hljs-number\">200<\/span>),placeholder (<span class=\"hljs-string\">'blur'<\/span>)]}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/cloudinary-marketing-res.cloudinary.com\/image\/upload\/c_limit,w_2000\/f_auto\/q_auto\/v1764273144\/blog-Create_a_Responsive_React_Image_Component_With_Cloudinary-React_SDKs-4.webp\" alt=\"GIF of the responsive plugins\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"582\" height=\"296\"\/><\/p>\n<blockquote>\n<p>The order of the plugins is important to ensure that everything works correctly.<\/p>\n<\/blockquote>\n<p>The responsive plugin function accepts either a single value (step) or an array of values. In our case, we passed in a single value &#8211; 200 pixels. Each time the viewport size increases or decreases by that value, a new image will be loaded.<\/p>\n<p>Find the source code here on <a href=\"https:\/\/github.com\/ifeoma-imoh\/cloudinary-react-image-optimization.git\">Github<\/a>.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this blog post, we explored how to use some of the advanced features of the Cloudinary-React SDK and JavaScript SDK to build and apply various transformations to our image component. Get more information about the Cloudinary React SDK v2 and plugins <a href=\"https:\/\/cloudinary.com\/documentation\/react2_quick_start\">here<\/a>, and <a href=\"https:\/\/cloudinary.com\/users\/register_free\">sign up for a free account today<\/a>.<\/p>\n<p>Resources:<\/p>\n<ul>\n<li>\n<a href=\"https:\/\/reactjs.org\/\">React.js Documentation<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/javascript_integration\">JavaScript SDK v2<\/a> documentation<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/documentation\/react_quick_start\">React SDK v2<\/a> documentation<\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":87,"featured_media":30865,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[134,370,177,246,249],"class_list":["post-27922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-guest-post","tag-image","tag-javascript","tag-react","tag-responsive"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Create a Responsive React Image Component With Cloudinary-React SDKs<\/title>\n<meta name=\"description\" content=\"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/create-react-image-component\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a Responsive React Image Component With Cloudinary-React SDKs\" \/>\n<meta property=\"og:description\" content=\"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/create-react-image-component\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-11T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-27T19:58:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1100\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"melindapham\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component\"},\"author\":{\"name\":\"melindapham\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\"},\"headline\":\"Create a Responsive React Image Component With Cloudinary-React SDKs\",\"datePublished\":\"2023-08-11T14:00:00+00:00\",\"dateModified\":\"2025-11-27T19:58:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component\"},\"wordCount\":9,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA\",\"keywords\":[\"Guest Post\",\"Image\",\"Javascript\",\"React\",\"Responsive\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2023\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component\",\"url\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component\",\"name\":\"Create a Responsive React Image Component With Cloudinary-React SDKs\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA\",\"datePublished\":\"2023-08-11T14:00:00+00:00\",\"dateModified\":\"2025-11-27T19:58:00+00:00\",\"description\":\"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/create-react-image-component\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/create-react-image-component#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create a Responsive React Image Component With Cloudinary-React SDKs\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\",\"name\":\"melindapham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g\",\"caption\":\"melindapham\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Create a Responsive React Image Component With Cloudinary-React SDKs","description":"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/create-react-image-component","og_locale":"en_US","og_type":"article","og_title":"Create a Responsive React Image Component With Cloudinary-React SDKs","og_description":"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.","og_url":"https:\/\/cloudinary.com\/blog\/create-react-image-component","og_site_name":"Cloudinary Blog","article_published_time":"2023-08-11T14:00:00+00:00","article_modified_time":"2025-11-27T19:58:00+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","type":"image\/jpeg"}],"author":"melindapham","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component"},"author":{"name":"melindapham","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9"},"headline":"Create a Responsive React Image Component With Cloudinary-React SDKs","datePublished":"2023-08-11T14:00:00+00:00","dateModified":"2025-11-27T19:58:00+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component"},"wordCount":9,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","keywords":["Guest Post","Image","Javascript","React","Responsive"],"inLanguage":"en-US","copyrightYear":"2023","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component","url":"https:\/\/cloudinary.com\/blog\/create-react-image-component","name":"Create a Responsive React Image Component With Cloudinary-React SDKs","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","datePublished":"2023-08-11T14:00:00+00:00","dateModified":"2025-11-27T19:58:00+00:00","description":"In this post, we will explore how to use some of the advanced features of the Cloudinary-React library to build and apply various transformations to our React image component.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/create-react-image-component"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/create-react-image-component#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create a Responsive React Image Component With Cloudinary-React SDKs"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9","name":"melindapham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e6f989fa97fe94be61596259d8629c3df65aec4c7da5c0000f90d810f313d4f4?s=96&d=mm&r=g","caption":"melindapham"}}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1691619585\/Blog-Responsive_React_Image_Component\/Blog-Responsive_React_Image_Component.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=27922"}],"version-history":[{"count":15,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27922\/revisions"}],"predecessor-version":[{"id":39492,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/27922\/revisions\/39492"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/30865"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=27922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=27922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=27922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}