This is the
legacyversion of the React SDK (
cloudinary-react
v1.x).
For details on migrating to the current version of the SDK (frontend-frameworks
v1.x + js-url-gen
v1.x), see the React SDK migration guide.
Cloudinary's React SDK provides simple, yet comprehensive image and video upload, transformation, optimization, and delivery capabilities that you can implement using code that integrates seamlessly with your existing React application.
Quick exampleTake a look at the following transformation code and the image it delivers:
This relatively simple code performs all of the following on the original front_face.jpg image before delivering it:
And here's the URL that would be included in the image tag that's automatically generated from the above code:
In a similar way, you can transform a video.
React SDK featuresThe Cloudinary React SDK serves as a layer on top of Cloudinary's JavaScript (cloudinary-core
) library. Install the SDKs by running the following command:
The following 4 elements are available:
To use the Cloudinary React elements, you must configure at least your Cloudinary product environment cloudName
. You can additionally define a number of optional configuration parameters if relevant. You can find your product environment configuration credentials in the API Keys page of the Cloudinary Console Settings. You can apply these settings directly to each element, or you can apply them to all child elements using a CloudinaryContext
element.
cloud_name
is required to be configured, and not your API key or secret. Your API secret should never be exposed on the client side, so if you want to use signed uploads or generate delivery signatures, you'll also need server-side code, for which you can use one of our backend SDKs.secure
configuration parameter is false
. However, for most modern applications, it's recommended to configure the secure
parameter to true
to ensure that your transformation URLs are always generated as HTTPS.For example:
CloudinaryContext
applies to all child elements:The JavaScript cloudinary-core (legacy) library is the foundation library underlying Cloudinary's React SDK. You can access any of the core JavaScript functionality within your React code after importing the core library. For example:
React capitalization and data type guidelinesWhen using the React SDK, keep these guidelines in mind:
camelCase
. For example: publicIdPascalCase
. For example: ImageTagcamelCase
. For example: toHTMLObject
See our React Photo Album sample project that includes code for uploading files, deleting files, and using dynamic lists: https://github.com/cloudinary/cloudinary-react/tree/master/samples/photo_album
React Storybook toolYou can try out Cloudinary components quickly and easily with our React SDK Storybook, which provides you with a rich visual interface, code playground and inline documentation.
To start using the storybook, select a component from the left-hand menu. Depending on which component you choose, you can either display an asset from your own Cloudinary product environment, experiment by changing parameters, and view the results, or you can scroll and view many different examples of implementations enabled by your selected Cloudinary component.
Either way, when you've found your desired effect, you can copy the code to conveniently implement the results.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4