Cod*_*elp 6 asp.net-mvc-4 reactjs
我想试用React并开始按照这里的教程开始 使用Internet模板,在_Layout.cshtml中添加了所需的脚本引用,并将以下脚本放在About.cshtml中.
带有'@'字符的代码给出了麻烦:
<script type="text/jsx">
/**
* @jsx React.DOM
*/
// The above declaration must remain intact at the top of the script.
// Your code here
</script>
Run Code Online (Sandbox Code Playgroud)
MVC说:
"jsx"这个名称在当前上下文中不存在
请提供一些指示
问候.
Dan*_*gro 10
我刚刚发布了ReactJS.NET,它可以让你轻松地将JSX编译为JavaScript.使用ReactJS.NET,您可以将代码放入.jsx文件(例如/Scripts/HelloWorld.jsx
),然后通过脚本标记引用它:
<script src="@Url.Content("~/Scripts/HelloWorld.jsx")"></script>
Run Code Online (Sandbox Code Playgroud)
此外,还支持ASP.NET Bundling和Minification以及Cassette.
原始答案(2014年4月4日前):
你需要@
通过写两次来逃避:
<script type="text/jsx">
/**
* @@jsx React.DOM
*/
// The above declaration must remain intact at the top of the script.
// Your code here
</script>
Run Code Online (Sandbox Code Playgroud)
我目前正在研究一些东西,以便更容易地使用ASP.NET中的React,它应该很快就会推出.这包括JSX的服务器端编译(动态和通过ASP.NET缩小和组合)和React组件的可选服务器端呈现.敬请关注!
归档时间: |
|
查看次数: |
7322 次 |
最近记录: |