{"id":34652,"date":"2024-07-09T07:00:00","date_gmt":"2024-07-09T14:00:00","guid":{"rendered":"https:\/\/cloudinary.com\/blog\/?p=34652"},"modified":"2025-03-03T15:56:18","modified_gmt":"2025-03-03T23:56:18","slug":"reacts-compiler-optimized-image-handling","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling","title":{"rendered":"Leveraging React&#8217;s Compiler With Cloudinary for Optimized Image Handling"},"content":{"rendered":"\n<p>React&#8217;s new compiler introduces a groundbreaking advancement in performance optimization by automatically memoizing components and hooks during the build process. This reduces unnecessary re-computations, enhancing the efficiency of updates. Memoization is crucial for optimizing performance, especially in applications with heavy rendering requirements. In this blog post, we&#8217;ll explore React&#8217;s new compiler through a sample project featuring a card-flipping animation, where we&#8217;ll see the benefits of automatic memoization in action using React DevTools.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>To fully benefit from this blog post, you should have a basic understanding of:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>JavaScript<\/strong>. Essential for writing the logic in our React components.<\/li>\n\n\n\n<li><strong>React.js<\/strong>. Knowledge of React&#8217;s component-based architecture.<\/li>\n\n\n\n<li><strong>Tailwind CSS<\/strong>. Familiarity with utility-first CSS for styling components.<\/li>\n\n\n\n<li><strong>Next.js 14 app router<\/strong>. The latest Next.js routing and data fetching methods.<\/li>\n\n\n\n<li><strong>Cloudinary<\/strong>. Experience with image management and transformations using Cloudinary.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Understanding React&#8217;s New Compiler<\/h2>\n\n\n\n<p>The React compiler optimizes the performance of React applications by automatically memoizing code. This means that React can skip re-rendering parts of the application that haven\u2019t changed, reducing the computational load during updates. Traditionally, developers use hooks like <code>useMemo<\/code>, <code>useCallback<\/code>, and <code>React.memo<\/code> to achieve this, but React\u2019s new compiler does this automatically, ensuring optimal performance without the need for manual intervention.<\/p>\n\n\n<div class='c-callout  c-callout--inline-title c-callout--note'><strong class='c-callout__title'>Note:<\/strong> <p>React does state on their docs that this is experimental and a WIP.\u00a0 However, Facebook and Meta have been using this for a while now internally, so it\u2019s probably close to being capable of shipping into production applications.\u00a0 Just use it with caution.\u00a0\u00a0<\/p>\n<p>It also works with plain JavaScript, and understands the <a href=\"https:\/\/react.dev\/reference\/rules\">Rules of React<\/a>, so you don\u2019t need to rewrite any code to use it.<\/p>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Setting Up the Project<\/h2>\n\n\n\n<p>Let&#8217;s start by setting up our <a href=\"https:\/\/react.dev\/learn\/react-compiler#usage-with-nextjs\">Next.js project with the canary branch for React compiler<\/a> and integrating Tailwind CSS for styling. We\u2019ll build a sample project that demonstrates the card-flipping animation using images from Cloudinary.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1. Initialize the Next.js Project<\/strong><\/h3>\n\n\n\n<p>Go to your terminal and run:<\/p>\n\n\n<pre class=\"wp-block-code\" 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-selector-tag\">next<\/span><span class=\"hljs-keyword\">@canary<\/span> babel-plugin-react-compiler<\/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\n\n<p>Then configure the experimental option in <code>next.config.js<\/code> at your projects root:<\/p>\n\n\n<pre class=\"wp-block-code\" 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-comment\">\/\/ next.config.js<\/span>\n<span class=\"hljs-comment\">\/** <span class=\"hljs-doctag\">@type <span class=\"hljs-type\">{import('next').NextConfig}<\/span> <\/span>*\/<\/span>\n<span class=\"hljs-keyword\">const<\/span> nextConfig = {\n  <span class=\"hljs-attr\">experimental<\/span>: {\n    <span class=\"hljs-attr\">reactCompiler<\/span>: <span class=\"hljs-literal\">true<\/span>,\n  },\n};\n\n<span class=\"hljs-built_in\">module<\/span>.exports = nextConfig;\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\n\n<h3 class=\"wp-block-heading\"><strong>Step 2. Configure Tailwind CSS<\/strong><\/h3>\n\n\n\n<p>Since Tailwind comes in the Next.js 14 package, you don\u2019t have to install it.&nbsp; Simply edit the <code>tailwind.config.js<\/code> file in the root of your application like so:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-comment\">\/** <span class=\"hljs-doctag\">@type <span class=\"hljs-type\">{import('tailwindcss').Config}<\/span> <\/span>*\/<\/span>\n<span class=\"hljs-built_in\">module<\/span>.exports = {\n  <span class=\"hljs-attr\">content<\/span>: &#91;\n    <span class=\"hljs-string\">\".\/pages\/**\/*.{js,ts,jsx,tsx,mdx}\"<\/span>,\n    <span class=\"hljs-string\">\".\/components\/**\/*.{js,ts,jsx,tsx,mdx}\"<\/span>,\n    <span class=\"hljs-string\">\".\/app\/**\/*.{js,ts,jsx,tsx,mdx}\"<\/span>,\n  ],\n  <span class=\"hljs-attr\">theme<\/span>: {\n    <span class=\"hljs-attr\">extend<\/span>: {\n      <span class=\"hljs-attr\">backgroundImage<\/span>: {\n        <span class=\"hljs-string\">\"gradient-radial\"<\/span>: <span class=\"hljs-string\">\"radial-gradient(var(--tw-gradient-stops))\"<\/span>,\n        <span class=\"hljs-string\">\"gradient-conic\"<\/span>: <span class=\"hljs-string\">\"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))\"<\/span>,\n      },\n      <span class=\"hljs-attr\">transitionDuration<\/span>: {\n        <span class=\"hljs-string\">'600'<\/span>: <span class=\"hljs-string\">'600ms'<\/span>,\n      },\n      <span class=\"hljs-attr\">rotate<\/span>: {\n        <span class=\"hljs-string\">'y-180'<\/span>: <span class=\"hljs-string\">'rotateY(180deg)'<\/span>,\n      },\n      <span class=\"hljs-attr\">transformStyle<\/span>: {\n        <span class=\"hljs-string\">'preserve-3d'<\/span>: <span class=\"hljs-string\">'preserve-3d'<\/span>,\n      },\n      <span class=\"hljs-attr\">backfaceVisibility<\/span>: {\n        <span class=\"hljs-string\">'hidden'<\/span>: <span class=\"hljs-string\">'hidden'<\/span>,\n      },\n    },\n  },\n  <span class=\"hljs-attr\">plugins<\/span>: &#91;],\n};\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\n\n<h3 class=\"wp-block-heading\"><strong>Step 3. Add Global Styles<\/strong><\/h3>\n\n\n\n<p>In the root of the <code>app<\/code> folder, navigate to your <code>globals.css<\/code> file and edit to add this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css shcb-wrap-lines\"><span class=\"hljs-keyword\">@tailwind<\/span> base;\n<span class=\"hljs-keyword\">@tailwind<\/span> components;\n<span class=\"hljs-keyword\">@tailwind<\/span> utilities;\n\n<span class=\"hljs-selector-class\">.perspective<\/span> {\n  <span class=\"hljs-attribute\">perspective<\/span>: <span class=\"hljs-number\">1000px<\/span>;\n}\n\n<span class=\"hljs-selector-class\">.backface-hidden<\/span> {\n  <span class=\"hljs-attribute\">backface-visibility<\/span>: hidden;\n}\n\n<span class=\"hljs-selector-class\">.transform-style-preserve-3d<\/span> {\n  <span class=\"hljs-attribute\">transform-style<\/span>: preserve-<span class=\"hljs-number\">3<\/span>d;\n}\n\n<span class=\"hljs-selector-class\">.rotate-y-180<\/span> {\n  <span class=\"hljs-attribute\">transform<\/span>: <span class=\"hljs-built_in\">rotateY<\/span>(<span class=\"hljs-number\">180deg<\/span>);\n}\n\n<span class=\"hljs-comment\">\/* Set background color of all pages to navy blue *\/<\/span>\n<span class=\"hljs-selector-tag\">body<\/span> {\n  <span class=\"hljs-attribute\">background-color<\/span>: navy;\n  <span class=\"hljs-attribute\">color<\/span>: white; <span class=\"hljs-comment\">\/* Ensuring text is readable on a dark background *\/<\/span>\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><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\n\n<h2 class=\"wp-block-heading\">Configuring Cloudinary<\/h2>\n\n\n\n<p>The Cloudinary team has made it seamless and easy to install their dependency into Next.js. Go to your terminal and add this command:<\/p>\n\n\n<pre class=\"wp-block-code\" 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-string\">`npm install cloudinary`<\/span><\/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\n\n<p>This is the Cloudinary Node SDK, which allows you to quickly and easily integrate your application with Cloudinary. It will help optimize, transform, upload, and manage cloud&#8217;s assets.<\/p>\n\n\n\n<p>Once done, go to the root of your Next.js project and in your <code>next.config.js<\/code> file, add this edit to allow Cloudinary images:<\/p>\n\n\n<pre class=\"wp-block-code\" 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\">\/\/ next.config.js<\/span>\n<span class=\"hljs-comment\">\/** <span class=\"hljs-doctag\">@type <span class=\"hljs-type\">{import('next').NextConfig}<\/span> <\/span>*\/<\/span>\n<span class=\"hljs-keyword\">const<\/span> nextConfig = {\n  <span class=\"hljs-attr\">experimental<\/span>: {\n    <span class=\"hljs-attr\">reactCompiler<\/span>: <span class=\"hljs-literal\">true<\/span>,\n  },\n  <span class=\"hljs-attr\">images<\/span>: {\n    <span class=\"hljs-attr\">domains<\/span>: &#91;<span class=\"hljs-string\">\"res.cloudinary.com\"<\/span>],\n  },\n};\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> nextConfig;\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\n\n<p>Just like that, we\u2019re all set up to process public images from your Cloudinary account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Building the Card Component<\/h2>\n\n\n\n<p>The <code>Card.js<\/code> file will be the component that will handle the flipping logic using state to toggle between the front and back images.&nbsp; Create a <code>components<\/code> folder in the root of the <code>app<\/code> directory and add this code block:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-string\">\"use client\"<\/span>;\n\n<span class=\"hljs-keyword\">import<\/span> React, { useState } <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> PropTypes <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"prop-types\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> Image <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"next\/image\"<\/span>;\n\n<span class=\"hljs-keyword\">const<\/span> Card = <span class=\"hljs-function\">(<span class=\"hljs-params\">{ frontImageId, backImageId }<\/span>) =&gt;<\/span> {\n  <span class=\"hljs-keyword\">const<\/span> &#91;isFlipped, setIsFlipped] = useState(<span class=\"hljs-literal\">false<\/span>);\n\n  <span class=\"hljs-keyword\">const<\/span> handleClick = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n    setIsFlipped(!isFlipped);\n  };\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\">className<\/span>=<span class=\"hljs-string\">\"w-64 h-64 perspective\"<\/span> <span class=\"hljs-attr\">onClick<\/span>=<span class=\"hljs-string\">{handleClick}<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">{<\/span>`<span class=\"hljs-attr\">relative<\/span> <span class=\"hljs-attr\">w-full<\/span> <span class=\"hljs-attr\">h-full<\/span> <span class=\"hljs-attr\">duration-600<\/span> <span class=\"hljs-attr\">transform-style-preserve-3d<\/span> ${<span class=\"hljs-attr\">isFlipped<\/span> ? \"<span class=\"hljs-attr\">rotate-y-180<\/span>\" <span class=\"hljs-attr\">:<\/span> \"\"}`}&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"absolute w-full h-full backface-hidden\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Image<\/span>\n            <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{<\/span>`<span class=\"hljs-attr\">https:<\/span>\/\/<span class=\"hljs-attr\">res.cloudinary.com<\/span>\/<span class=\"hljs-attr\">your-cloud-name<\/span>\/<span class=\"hljs-attr\">image<\/span>\/<span class=\"hljs-attr\">upload<\/span>\/${<span class=\"hljs-attr\">frontImageId<\/span>}`}\n            <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Front Image\"<\/span>\n            <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">{256}<\/span>\n            <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">{256}<\/span>\n            <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"object-cover rounded-lg\"<\/span>\n          \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"absolute w-full h-full rotate-y-180 backface-hidden\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Image<\/span>\n            <span class=\"hljs-attr\">src<\/span>=<span class=\"hljs-string\">{<\/span>`<span class=\"hljs-attr\">https:<\/span>\/\/<span class=\"hljs-attr\">res.cloudinary.com<\/span>\/<span class=\"hljs-attr\">your-cloud-name<\/span>\/<span class=\"hljs-attr\">image<\/span>\/<span class=\"hljs-attr\">upload<\/span>\/${<span class=\"hljs-attr\">backImageId<\/span>}`}\n            <span class=\"hljs-attr\">alt<\/span>=<span class=\"hljs-string\">\"Back Image\"<\/span>\n            <span class=\"hljs-attr\">width<\/span>=<span class=\"hljs-string\">{256}<\/span>\n            <span class=\"hljs-attr\">height<\/span>=<span class=\"hljs-string\">{256}<\/span>\n            <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"object-cover rounded-lg\"<\/span>\n          \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n  );\n};\n\nCard.propTypes = {\n  <span class=\"hljs-attr\">frontImageId<\/span>: PropTypes.string.isRequired,\n  <span class=\"hljs-attr\">backImageId<\/span>: PropTypes.string.isRequired,\n};\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> Card;\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\n\n<p>At the top of the file, we include the &#8220;use client&#8221; directive to inform Next.js that this is a client-side component. This is necessary because Next.js 14 defaults to server components. We\u2019ll then import useState from React to manage the flipping state of the card<\/p>\n\n\n\n<p>Within the Card component, we\u2019ll use the useState hook to create a boolean state variable, isFlipped, which toggles between true and false when the card is clicked. The handleClick function toggles this state, effectively flipping the card.<\/p>\n\n\n\n<p>The component structure involves a parent div with a CSS class for perspective, ensuring the 3D effect is visible. Inside this, we conditionally apply the rotate-y-180 class based on the isFlipped state to perform the flip animation.<\/p>\n\n\n\n<p>For the images, we\u2019ll use the Image component from Next.js, setting the src attribute to the Cloudinary URL, which includes your Cloudinary cloud name. Make sure to replace &#8220;your-cloud-name&#8221; with your actual Cloudinary cloud name obtained from the Cloudinary dashboard. Each Image component has defined dimensions and applies Tailwind CSS classes for styling.<\/p>\n\n\n\n<p>Lastly, we\u2019ll define propTypes to ensure frontImageId and backImageId are required string props, validating that the necessary data is passed to the component. This helps maintain type safety and ensures the component functions correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Displaying the Card Components<\/h3>\n\n\n\n<p>The ImageGallery component will display multiple Card components, each capable of flipping between two images.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" 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> React <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\"react\"<\/span>;\n<span class=\"hljs-keyword\">import<\/span> Card <span class=\"hljs-keyword\">from<\/span> <span class=\"hljs-string\">\".\/Card\"<\/span>;\n\n<span class=\"hljs-keyword\">const<\/span> ImageGallery = <span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-keyword\">const<\/span> images = &#91;\n    {\n      <span class=\"hljs-attr\">front<\/span>: <span class=\"hljs-string\">\"sample\"<\/span>,\n      <span class=\"hljs-attr\">back<\/span>: <span class=\"hljs-string\">\"kenny-eliason-5lkoseqWobM-unsplash\"<\/span>,\n    },\n    { <span class=\"hljs-attr\">front<\/span>: <span class=\"hljs-string\">\"sample\"<\/span>, <span class=\"hljs-attr\">back<\/span>: <span class=\"hljs-string\">\"wpgraphql\"<\/span> },\n    { <span class=\"hljs-attr\">front<\/span>: <span class=\"hljs-string\">\"sample\"<\/span>, <span class=\"hljs-attr\">back<\/span>: <span class=\"hljs-string\">\"card_8_rulqmw\"<\/span> },\n  ];\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\">className<\/span>=<span class=\"hljs-string\">\"flex flex-row justify-center space-x-8\"<\/span>&gt;<\/span>\n      {images.map((image, index) =&gt; (\n        <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">key<\/span>=<span class=\"hljs-string\">{index}<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"flex flex-col items-center space-y-2\"<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2<\/span> <span class=\"hljs-attr\">className<\/span>=<span class=\"hljs-string\">\"text-lg font-semibold\"<\/span>&gt;<\/span>Image {index + 1}<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h2<\/span>&gt;<\/span>\n          <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Card<\/span> <span class=\"hljs-attr\">frontImageId<\/span>=<span class=\"hljs-string\">{image.front}<\/span> <span class=\"hljs-attr\">backImageId<\/span>=<span class=\"hljs-string\">{image.back}<\/span> \/&gt;<\/span>\n        <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n      ))}\n    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/span>\n  );\n};\n\n<span class=\"hljs-keyword\">export<\/span> <span class=\"hljs-keyword\">default<\/span> ImageGallery;\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><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\n\n<p>We have a React server component here that takes in the variables of images from your Cloudinary account. This is an array with the object that contains the hard-coded names from your Cloudinary image file names. In this case, I\u2019ll use my own, but feel free to swap those out in your own code.&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Analyzing With React DevTools<\/h2>\n\n\n\n<p>We\u2019re all set and good to go.&nbsp; Let\u2019s run the project on the dev server.&nbsp; In the terminal, run npm run dev, open your browser, and navigate to <a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>. You should see a page like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1024\" height=\"613\" data-public-id=\"Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_613,c_scale\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA\" alt=\"\" class=\"wp-post-34652 wp-image-34653\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1720550883\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA 1999w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550883\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-1.png?_i=AA 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the above image, all three start with the flower image, but upon clicking the image, you should be able to flip it and reveal the backside of the image, which in my case is a truck and the WPGraphQL symbol.<br>The next step is to check how React auto memoizes components.&nbsp; If you don\u2019t have React Dev Tools installed, please do so now.&nbsp; I am using <a href=\"https:\/\/chromewebstore.google.com\/detail\/react-developer-tools\/fmkadmapgofadopljbjfkapdkoienihi?hl=en\">Google Chrome\u2019s extension<\/a>. Now that you have it installed, open the Dev Tools in the browser. If you\u2019re on a Mac, it\u2019s <strong>CMB + Option + I<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1024\" height=\"618\" data-public-id=\"Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_618,c_scale\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA\" alt=\"\" class=\"wp-post-34652 wp-image-34654\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1720550876\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA 1999w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550876\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-2.png?_i=AA 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now, go to the top of the toolbar right next to <strong>Sources<\/strong>. There are two arrows on top of each other. Click that to reveal this dropdown:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1024\" height=\"617\" data-public-id=\"Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_617,c_scale\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA\" alt=\"\" class=\"wp-post-34652 wp-image-34655\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1720550869\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA 1999w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550869\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-3.png?_i=AA 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>When you reveal the dropdown, click <strong>Components<\/strong>.&nbsp; Scroll down to the <strong>Card<\/strong> section and you should see the word \u201cMemo<strong> \u2728<\/strong>\u201d<strong><em> <\/em><\/strong>next to it!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1024\" height=\"608\" data-public-id=\"Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/w_1024,h_608,c_scale\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA\" alt=\"\" class=\"wp-post-34652 wp-image-34656\" data-format=\"png\" data-transformations=\"f_auto,q_auto\" data-version=\"1720550862\" data-seo=\"1\" srcset=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA 1999w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA 300w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA 768w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA 1024w, https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720550862\/Web_Assets\/blog\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4\/blog-Leveraging-Reacts-Compiler-With-Cloudinary-for-Optimized-Image-Handling-4.png?_i=AA 1536w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>What\u2019s happening is the Card components are memoized without explicitly using React.memo.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Memoization<\/h3>\n\n\n\n<p>Memoization ensures that the Card components dont re-render unnecessarily, which can be verified by observing the components&#8217; props and state in React DevTools. The new React compiler optimizes these re-renders, improving performance significantly.&nbsp; And we didn\u2019t have to do anything except install the new version and the canary!&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>React&#8217;s new compiler introduces automatic memoization, reducing the need for manual optimizations with hooks like useMemo and React.memo. By integrating Tailwind CSS for styling and Cloudinary for image handling, we demonstrated a practical example of a card-flipping animation.&nbsp;<\/p>\n\n\n\n<p>The use of React DevTools further highlights the benefits of automatic memoization, ensuring our components are optimized for performance without additional code. This setup not only enhances performance but also simplifies the development process, making it easier to build efficient and responsive React applications.<\/p>\n\n\n\n<p>Build your next React project using Cloudinary\u2019s extensive image transformations. <a href=\"https:\/\/cloudinary.com\/\">Sign up for free today<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>React&#8217;s new compiler introduces a groundbreaking advancement in performance optimization by automatically memoizing components and hooks during the build process. This reduces unnecessary re-computations, enhancing the efficiency of updates. Memoization is crucial for optimizing performance, especially in applications with heavy rendering requirements. In this blog post, we&#8217;ll explore React&#8217;s new compiler through a sample project [&hellip;]<\/p>\n","protected":false},"author":87,"featured_media":34658,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[134,165,227,246],"class_list":["post-34652","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-guest-post","tag-image-transformation","tag-performance-optimization","tag-react"],"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>Optimize Image Handling With React&#039;s Compiler and Cloudinary<\/title>\n<meta name=\"description\" content=\"Read about React&#039;s new compiler through a sample project and see the benefits of automatic memoization using React DevTools.\" \/>\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\/reacts-compiler-optimized-image-handling\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Leveraging React&#039;s Compiler With Cloudinary for Optimized Image Handling\" \/>\n<meta property=\"og:description\" content=\"Read about React&#039;s new compiler through a sample project and see the benefits of automatic memoization using React DevTools.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-09T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-03T23:56:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog-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\/reacts-compiler-optimized-image-handling#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\"},\"author\":{\"name\":\"melindapham\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9\"},\"headline\":\"Leveraging React&#8217;s Compiler With Cloudinary for Optimized Image Handling\",\"datePublished\":\"2024-07-09T14:00:00+00:00\",\"dateModified\":\"2025-03-03T23:56:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\"},\"wordCount\":1115,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA\",\"keywords\":[\"Guest Post\",\"Image Transformation\",\"Performance Optimization\",\"React\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2024\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\",\"url\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\",\"name\":\"Optimize Image Handling With React's Compiler and Cloudinary\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA\",\"datePublished\":\"2024-07-09T14:00:00+00:00\",\"dateModified\":\"2025-03-03T23:56:18+00:00\",\"description\":\"Read about React's new compiler through a sample project and see the benefits of automatic memoization using React DevTools.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA\",\"width\":2000,\"height\":1100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Leveraging React&#8217;s Compiler With Cloudinary for Optimized Image Handling\"}]},{\"@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":"Optimize Image Handling With React's Compiler and Cloudinary","description":"Read about React's new compiler through a sample project and see the benefits of automatic memoization using React DevTools.","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\/reacts-compiler-optimized-image-handling","og_locale":"en_US","og_type":"article","og_title":"Leveraging React's Compiler With Cloudinary for Optimized Image Handling","og_description":"Read about React's new compiler through a sample project and see the benefits of automatic memoization using React DevTools.","og_url":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling","og_site_name":"Cloudinary Blog","article_published_time":"2024-07-09T14:00:00+00:00","article_modified_time":"2025-03-03T23:56:18+00:00","og_image":[{"width":2000,"height":1100,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog-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\/reacts-compiler-optimized-image-handling#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling"},"author":{"name":"melindapham","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/person\/0d5ad601e4c3b5be89245dfb14be42d9"},"headline":"Leveraging React&#8217;s Compiler With Cloudinary for Optimized Image Handling","datePublished":"2024-07-09T14:00:00+00:00","dateModified":"2025-03-03T23:56:18+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling"},"wordCount":1115,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA","keywords":["Guest Post","Image Transformation","Performance Optimization","React"],"inLanguage":"en-US","copyrightYear":"2024","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling","url":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling","name":"Optimize Image Handling With React's Compiler and Cloudinary","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA","datePublished":"2024-07-09T14:00:00+00:00","dateModified":"2025-03-03T23:56:18+00:00","description":"Read about React's new compiler through a sample project and see the benefits of automatic memoization using React DevTools.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA","width":2000,"height":1100},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/reacts-compiler-optimized-image-handling#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Leveraging React&#8217;s Compiler With Cloudinary for Optimized Image Handling"}]},{"@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\/v1720031041\/react_cldn_optimized_images-blog\/react_cldn_optimized_images-blog.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/34652","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=34652"}],"version-history":[{"count":3,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/34652\/revisions"}],"predecessor-version":[{"id":37119,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/34652\/revisions\/37119"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/34658"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=34652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=34652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=34652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}