I am getting the following error in React.
Images.js:15 Uncaught TypeError: axios__WEBPACK_IMPORTED_MODULE_0__.Axios.get is not a function
I followed the following process.
- I install the npm install axios. 2)then I try to use the method get() for that, I imported the axios> import { Axios } from 'axios';
Here is my function
inputRef.current.focus()
Axios.get("https://api.unsplash.com/photos/?client_id=Q6F2UZogduuqcTc6rRGUs6ZOIo8yhNIpP4tiJHm0CrE").then(res => {
console.log(res);
} ).then(res => {
console.log(res);
});
// console.log(varRef);
},[]);
after that I run npm run start and got blank but in console, I am getting the Images.js:15 Uncaught TypeError: axios__WEBPACK_IMPORTED_MODULE_0__.Axios.get is not a function
CodePudding user response:
have you tried renaming the import to as followed:
import axios from "axios";
this is what worked for me