Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 为什么ReactJS.net没有React的导入语句?_Asp.net_Asp.net Mvc_Reactjs_Reactjs.net - Fatal编程技术网

Asp.net 为什么ReactJS.net没有React的导入语句?

Asp.net 为什么ReactJS.net没有React的导入语句?,asp.net,asp.net-mvc,reactjs,reactjs.net,Asp.net,Asp.net Mvc,Reactjs,Reactjs.net,我正在玩,想在我现有的ASP.NET MVC应用程序中设置一个应用程序 我在VisualStudio中使用“默认安装模板”制作了几个简单的React应用程序,但不基于ReactJS.net,其中的内容只是一个子页面 但是,如果我以使用的教程模板为例: var CommentBox = React.createClass({ render: function () { return ( <div className="commentBox"&g

我正在玩,想在我现有的ASP.NET MVC应用程序中设置一个应用程序

我在VisualStudio中使用“默认安装模板”制作了几个简单的React应用程序,但不基于ReactJS.net,其中的内容只是一个子页面

但是,如果我以使用的教程模板为例:

var CommentBox = React.createClass({
    render: function () {
        return (
            <div className="commentBox">
                Hello, world! I am a CommentBox.
      </div>
        );
    }
});
ReactDOM.render(
    <CommentBox />,
    document.getElementById('content')
);
var CommentBox=React.createClass({
渲染:函数(){
返回(
你好,世界!我是一个评论箱。
);
}
});
ReactDOM.render(
,
document.getElementById('content')
);
没有导入React,例如:
import*as React from'React',我已经习惯了


所以我的问题是:为什么不呢?什么时候应该导入React?

因为
导入React来自“React”。Reactjs.Net不使用npm依赖项,您需要使用
将CDN放到视图中。基本上,当您使用CDN时,您会自动导入React,这可能是在网站中抽象出来的。您必须将
React
导入到您希望在web应用程序中使用的任何文件中