I am learning React.js and I converted this line into pure JavaScript using Babel's online converter:
const element = <div tabIndex="0"></div>;
became:
"use strict";
import { React } from "react";
var element = React.createElement("div", {
tabIndex: "0"
});
console.log(element)
But when I run it in Webstorm, I get an exception:
import { React } from "react";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1072:16)
at Module._compile (internal/modules/cjs/loader.js:1122:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47