I've tried to use reactJS inside .net framework MVC application.
View:
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js"></script>
<div id="root"></div>
@Scripts.Render("~/Scripts/ReactJS/test.jsx")
test.jsx:
import React from 'react';
import ReactDOM from 'react-dom';
const App = () => <div>Hello world!</div>;
ReactDOM.render(<App />, document.getElementById("root"));
Message is not shown and the error is:
test.jsx:2 Uncaught SyntaxError: Cannot use import statement outside a module
I don't understand why is this not working. I have included both react libraries and babel library.