DEV Community

Discussion on: Setting up a React Environment for ASP.NET MVC

Collapse
 
dance2die profile image
Sung M. Kim • Edited

Hi Bill.

I am sorry it's because the code snippet is out of sync from the instruction. You might want to use React.Fragment instead of <>...</> because it's a syntatic sugar (you'd need to set up plugin-transform-react-jsx for that syntax to work, which is not set up in this article.)

As a workaround, you can use React.Fragment directly as shown below (I've also updated the gist to reflect the change).

import React from 'react';
import { render } from 'react-dom';

const App = () => (
    <React.Fragment>
        <h1>React in ASP.NET MVC!</h1>
        <div>Hello React World</div>
    </React.Fragment>
);

render(<App />, document.getElementById('app'));
Collapse
 
webatxcent profile image
Bill Butler

Thanks so much for the quick reply.
That didn't change the outcome. Same error unexpected token.

I did note that the first line in the index.js file

import React from 'react';

was reporting an Intellisense error: "(js) cannot use imports, exports, or module augmentations when '--module' is 'none'"
Could this be a contributing factor.