@cloudinary/react

中文文档
1.14.4发布于 2026/02/12MITTypeScriptESM + CJS近 30 天下载 20.4万

Cloudinary React SDK

原始使用文档
文档目录17 节
  1. About
  2. Table of Contents
  3. Key Features
  4. Version Support
  5. Installation
  6. Install using your favorite package manager (yarn, npm)
  7. Usage
  8. Setup
  9. Transform and Optimize Assets
  10. Generate Image and Video HTML Tags
  11. Advanced Plugin Features
  12. File upload
  13. Contributions
  14. Get Help
  15. About Cloudinary
  16. Additional Resources
  17. License

Cloudinary React SDK

About

The Cloudinary React SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

Note

This Readme provides basic installation and usage information. For the complete documentation, see the React SDK Guide.

Table of Contents

Key Features

Version Support

SDK VersionReact 16React 17React 18
1.0.0 & upVVV

Installation

Install using your favorite package manager (yarn, npm)

npm i @cloudinary/url-gen @cloudinary/react --save

Or

yarn add @cloudinary/url-gen @cloudinary/react --save

Usage

Setup

import React from 'react';
import { AdvancedImage } from '@cloudinary/react'
import { Cloudinary } from '@cloudinary/url-gen';

Transform and Optimize Assets

import { AdvancedImage } from '@cloudinary/react'
import { Cloudinary } from '@cloudinary/url-gen';

const myCld = new Cloudinary({
  cloud: {
    cloudName: "demo",
  },
});

let img = myCld.image('sample');

const App = () => {
  return <AdvancedImage cldImg={img}/>
};

Generate Image and Video HTML Tags

- Use <AdvancedImage> to generate image tags
- Use <AdvancedVideo> to generate video tags

Advanced Plugin Features

import { CloudinaryImage } from "@cloudinary/url-gen";
import {
  lazyload,
  responsive,
  accessibility,
  placeholder
} from "@cloudinary/react";

cloudinaryImage = new CloudinaryImage("sample", { cloudName: "demo" });

const App = () => {
  return <AdvancedImage cldImg={img} plugins={[lazyload(),responsive(), accessibility(), placeholder()]} />;
};

You can omit any plugin, but the order from above should remain.

File upload

This SDK does not provide file upload functionality, however there are several methods of uploading from the client side.

Contributions

  • Ensure tests run locally (npm run test)
  • Open a PR and ensure Travis tests pass

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

License

Released under the MIT license.

版本与发布记录

@cloudinary/react 共发布 46 个版本,首次发布于 2021/01/03;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.14.4latest2026/02/128 个月前
1.14.32025/05/141.5 年前
1.14.22025/05/141.5 年前
1.14.12025/02/281.7 年前
1.14.02025/02/251.7 年前
1.13.12024/11/042 年前

其他发布通道:alpha → 1.0.0-alpha.5,beta → 1.0.0-beta.11。

关于 @cloudinary/react 的常见问题

@cloudinary/react 是什么?

Cloudinary React SDK

如何安装 @cloudinary/react?

在项目目录运行 npm install @cloudinary/react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.3.0 || ^17.0.0 || ^18.0.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@cloudinary/react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cloudinary/react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cloudinary/react 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=10。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cloudinary/react 可以商用吗?

@cloudinary/react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cloudinary/react 的下载量有多少?

根据 npm 官方下载统计,@cloudinary/react 在 2026/10/10 – 2026/11/08 这 30 天内被下载 204,007 次,日均约 6,800 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cloudinary/react 还在维护吗?

最新版本 1.14.4 发布于 2026/02/12(8 个月前);至今共发布 46 个版本,其中过去 12 个月发布了 1 个;首次发布于 2021/01/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。