No intellisense for React in Visual Studio 2015

时光毁灭记忆、已成空白 提交于 2019-12-22 06:37:29

问题


I don't see any intellisense for ReactJS, for example methods like React.createClass although I see _references.js file at the root folder. The _references.js file has help reference to various react js files.

The extension of my react file is JS and not JSX.


回答1:


I fixed this issue by importing the NuGet package "react.js" and bringing the script locally.

I've also added a _references.js to ~/Scripts/ to my project. Visual Studio had a helper under "add..." entitled "_references.js intellisense file" which looked like this:

/// <autosync enabled="true" />
/// <reference path="bootstrap.js" />
/// <reference path="jquery-2.1.4.js" />
/// <reference path="react/jsxtransformer-0.13.1.js" />
/// <reference path="react/react-0.13.1.js" />
/// <reference path="react/react-with-addons-0.13.1.js" />

After that, I was able to use intellisense in my jsx files. The _references.js file did not seem to like running from Facebook's CDN.



来源:https://stackoverflow.com/questions/32094173/no-intellisense-for-react-in-visual-studio-2015

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