I installed React.AspNet
in my MVC core project and it works fine, except that it does not allow import
statement in my .jsx
file. Specifically, I've installed the axios
library into my MVC project and would like to use it in the .jsx
file.
Simplified version of my code:
import axios from "axios";
function MyComponent({ url }) {
function getData() {
axios.get(url);
}
}
Error:
ScriptEngineException: SyntaxError: Cannot use import statement outside a module
Without the import
statement, I get an error that axios is not defined.
How can I get this to work?