🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

cloudinary-react-provider

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudinary-react-provider

React cloudinary context provider

1.0.3
latest
Source
npm
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Cloudinary React Provider

npm npm bundle size GitHub issues GitHub license

A React library that provides a Context Provider for easy integration of Cloudinary in your React applications.

Installation

npm install cloudinary-react-provider @cloudinary/url-gen @cloudinary/react

Usage

1. Wrap your application with CloudinaryProvider

Wrap your application with the CloudinaryProvider at the root level to provide the Cloudinary client to all components.

import React from 'react'
import { CloudinaryProvider } from 'cloudinary-react-provider'

const App = () => {
  return (
    <CloudinaryProvider cloudName='your-cloud-name'>{/* Your application components go here */}</CloudinaryProvider>
  )
}

export default App

2. Use the useCloudinary hook to access the Cloudinary client

Use the useCloudinary hook in any component to access the Cloudinary client instance.

import React from 'react'
import { useCloudinary } from 'cloudinary-react-provider'
import { AdvancedImage } from '@cloudinary/react'

const MyComponent = () => {
  const { client } = useCloudinary()
  const image = client.image('image_public_id')
  // Use the cloudinary instance here

  return (
    <div>
      <AdvancedImage cldImg={myImage} />
    </div>
  )
}

export default MyComponent

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Keywords

cloudinary

FAQs

Package last updated on 11 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts