I'm trying to use axios
in my code,
import axios from 'axios';
axios.get("http://someurl.com")
.then(response => {
console.log(response)
})
.catch(error => {
console.log("Error parsing data", error);
});
This throws the following error :
import axios from 'axios';
^^^^^
SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:743:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
at internal/main/run_main_module.js:21:11
What am I doing wrong here ?