【发布时间】:2018-04-01 15:29:39
【问题描述】:
我正在玩 https://reactjs.net/ ,并想在我现有的 ASP.NET MVC 应用程序中设置一个应用程序。
我使用 Visual Studio 中的“默认安装模板”制作了几个简单的 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')
);
没有像 import * as React from 'react'; 这样的导入 React,我已经习惯了。
所以我的问题是:为什么不呢?什么时候应该导入 React?
【问题讨论】:
-
它可能是在网站中抽象出来的。你绝对必须在你想在你的网络应用程序中使用它的任何文件中导入
React
标签: asp.net asp.net-mvc reactjs reactjs.net