I am trying to import { Image } from "cloudinary-react";
As instructed at Cloudinary-React
And getting the warning:
Could not find a declaration file for module 'cloudinary-react'. '/Users/myname/Web Projects/ProjectName/node_modules/cloudinary-react/dist/cloudinary-react.js' implicitly has an 'any' type. Try
npm i --save-dev @types/cloudinary-react
if it exists or add a new declaration (.d.ts) file containingdeclare module 'cloudinary-react';
ts(7016)
I am not using TypeScript.
I can not figure out what is going on. Does anyone have any ideas how I can resolve this? I have looked around for a few hours.
Package.json: "dependencies": { "axios": "^0.21.1", "bcrypt": "^5.0.0", "cloudinary": "^1.27.1", "cloudinary-react": "^1.7.0", ...
Thank you for any help.
The cloudinary-react module should normally be added in the node_modules
when it is installed in your project. The following sample code is shown in this sample project.
For the dependencies in package.json:
"dependencies": {
"cloudinary-react": "1.7.0",
"lodash": "4.17.21",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "4.0.0"
},
And Cloudinary components can be imported as shown below:
import React from "react";
import { Image } from "cloudinary-react";
class ImageDisplay extends React.Component {
render() {
return (
<div className="counter">
<Image cloudName="demo" publicId="sample" width="300" crop="scale" />
</div>
);
}
}
export default ImageDisplay;