React.NET

.NET library for JSX compilation and server-side rendering of React components

  • 所有者: reactjs/React.NET
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

ReactJS.NET

ReactJS.NET is a library that makes it easier to use Babel along with Facebook's React and JSX from C#.

Build status 
NuGet version
Download count

Features

Quick Start

Install the package

Install-Package React.Web.Mvc4 # For ASP.NET MVC 4 or 5
Install-Package React.AspNet   # For ASP.NET Core MVC

Install a Javascript engine and configure as the default (more info here on how this works)

Install-Package JavaScriptEngineSwitcher.V8
Install-Package JavaScriptEngineSwitcher.V8.Native.win-x64
public static class ReactConfig
{
    public static void Configure()
    {
        ReactSiteConfiguration.Configuration
            .AddScript("~/Content/HelloWorld.jsx");

        JsEngineSwitcher.Current.DefaultEngineName = V8JsEngine.EngineName;
        JsEngineSwitcher.Current.EngineFactories.AddV8();
    }
}

Create JSX files

// /Scripts/HelloWorld.jsx
const HelloWorld = props => {
	return <div>Hello {props.greeting}</div>;
};

Reference the JSX files from your HTML

<!-- Place this where you want the component div to render -->
@Html.React("HelloWorld", new { Greeting = "friends!" });

<!-- Place these at the end of the page -->
<script src="@Url.Content("~/Scripts/HelloWorld.jsx")"></script>
@Html.ReactInitJavaScript();

Now you can use the HelloWorld component.

For information on more advanced topics (including precompilation and
server-side rendering), check out the documentation

Building Manually and Contributing

When building your own copy of ReactJS.NET (for example, if implementing a new
feature or fixing a bug), your first build always needs to be done using the
build script (dev-build.bat) as this generates a few files required by the
build (such as SharedAssemblyVersionInfo.cs). Once this build is completed,
you can open React.sln in Visual Studio and compile directly from Visual
Studio. Please refer to the documentation page on
contributing
for more information on
contributing to ReactJS.NET.

Note that the build requires you to have Git installed. If you do not want to
install Git, you may remove the GitVersion task from build.proj.

主要指標

概覽
名稱與所有者reactjs/React.NET
主編程語言C#
編程語言CSS (語言數: 12)
平台
許可證MIT License
所有者活动
創建於2014-03-16 23:18:34
推送於2023-05-28 15:14:36
最后一次提交
發布數43
最新版本名稱5.2 (發布於 )
第一版名稱release-0.1.0 (發布於 2014-04-08 22:01:00)
用户参与
星數2.3k
關注者數120
派生數0.9k
提交數1.1k
已啟用問題?
問題數662
打開的問題數51
拉請求數447
打開的拉請求數55
關閉的拉請求數177
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?