asp.net-mvc-4 – 如何在ASP.NET MVC中使用React
发布时间:2020-12-15 21:00:02 所属栏目:asp.Net 来源:网络整理
导读:我想试用React并开始学习 here教程 使用Internet模板,在_Layout.cshtml中添加了所需的脚本引用,并将以下脚本放在About.cshtml中. 带有’@’字符的代码给出了麻烦: script type="text/jsx" /** * @jsx React.DOM */ // The above declaration must remain in
我想试用React并开始学习
here教程
使用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> MVC说:
请提供一些指示 问候. 解决方法
我刚刚发布了
ReactJS.NET,它可以让你轻松地将JSX编译为JavaScript.使用ReactJS.NET,您可以将代码放入.jsx文件(例如/Scripts/HelloWorld.jsx),然后通过脚本标记引用它:
<script src="@Url.Content("~/Scripts/HelloWorld.jsx")"></script> 此外,还支持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> 我目前正在研究一些东西,以便更容易地使用ASP.NET中的React,它应该很快就会推出.这包括JSX的服务器端编译(动态和通过ASP.NET缩小和组合)和React组件的可选服务器端呈现.敬请关注! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ASP.NET多线程如何?
- asp.net – JQuery Live()无效
- asp.net-mvc – 单元测试视图?
- asp.net-mvc – AOP vs MVC FilterAttributes vs Intercept
- asp.net-web-api – 如何告诉RavenDB忽略属性而不是WebAPI?
- asp.net-mvc-3 – 使用EditorFor/TextBoxFor/TextBox助手的
- 如何使用ASP.NET MVC增加对AJAX JSON响应的2MB限制
- ASP.NET 5 MVC(Visual Studio 2015):一个名为Inject的关键
- 如何保护经典ASP ASPSESSIONID cookie?
- asp.net-mvc – 禁止使用[授权]操作过滤器的控制器方法的浏
推荐文章
站长推荐
热点阅读