In Visual Studio 2012, I get warnings and squiggly lines when trying to write JSX with React JS

梦想与她 提交于 2020-01-03 11:02:21

问题


I am using a separate javascript file to put my React JS JSX in. When I use the example given by the documents, I get tons of Visual Studio warnings and ugly squiggly lines..

I cannot figure out a way around this.. Pretty much a deal breaker for React JS.


回答1:


Visual Studio 2012 was released before ReactJs, so you can't really blame them for not supporting it.

There is some visual studio stuff here:

http://reactjs.net/

You can see support for tooling being asked here:

https://github.com/reactjs/React.NET/issues/3

with Web Essentials being one of the prime picks for asking for support (might want to add your votes!)

If you are using Resharper it might be added in the next release, JetBrains is looking to add it into WebStorm

https://youtrack.jetbrains.com/issue/WEB-10136




回答2:


This is because you're essentially putting html into your javascript. I found this after a quick google search and might fix your problem: https://visualstudiogallery.msdn.microsoft.com/d65d6b29-6dd7-4100-81b1-609e5afce356

The page mentions: "Visual Studio currently doesn't have native JSX syntax support. You can edit .jsx files in regular VS JavaScript editor for now and vote for adding native JSX support in Visual Studio here (the most requested feature in WE)."



来源:https://stackoverflow.com/questions/26723092/in-visual-studio-2012-i-get-warnings-and-squiggly-lines-when-trying-to-write-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!