Hi, I tried out your process using VS2019, step by step and got the following error. Was hoping you might nudge me in the right direction :). [I am a relative newbie with npm]
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).
importReactfrom'react';import{render}from'react-dom';constApp=()=>(<React.Fragment><h1>React in ASP.NET MVC!</h1><div>Hello React World</div></React.Fragment>);render(<App/>,document.getElementById('app'));
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, I tried out your process using VS2019, step by step and got the following error. Was hoping you might nudge me in the right direction :). [I am a relative newbie with npm]
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).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
was reporting an Intellisense error: "(js) cannot use imports, exports, or module augmentations when '--module' is 'none'"
Could this be a contributing factor.