return <>
<NavItem>
<NavLink href={`/app/logout?returnUrl=${returnUrl}`}>Log out</NavLink>
</NavItem>
</>
I have the above code snippet inside a tsx file, in a folder in visual studio. It recognizes this class of files (it put the icon on them) and I even have intellisense for the classes and methods.
However, it doesn't recognize the fragment as such, and throws an error in the IDE. However the code compiles and runs without problems when doing npm start.
So it's an IDE problem.
Making
return <React.Fragment>
<NavItem>
<NavLink href={`/app/logout?returnUrl=${returnUrl}`}>Log out</NavLink>
</NavItem>
</React.Fragment>
It does not throw an error in the IDE. The question is, how do I tell my IDE that this code is OK? (or is it a VS bug?)
This problem occurs because the typescript SDK is not embedded in the Visual Studio installation, and must be installed separately. By default, a package prior to version 2.5 of Ts is installed, which did not contain the tag as valid
<>
.To solve this problem, you have to download the latest package from the Microsoft page and install it. By restarting Visual Studio, the problem will be resolved.