ReactDotNetCore.AspNetCore
0.1.0
See the version list below for details.
dotnet add package ReactDotNetCore.AspNetCore --version 0.1.0
NuGet\Install-Package ReactDotNetCore.AspNetCore -Version 0.1.0
<PackageReference Include="ReactDotNetCore.AspNetCore" Version="0.1.0" />
<PackageVersion Include="ReactDotNetCore.AspNetCore" Version="0.1.0" />
<PackageReference Include="ReactDotNetCore.AspNetCore" />
paket add ReactDotNetCore.AspNetCore --version 0.1.0
#r "nuget: ReactDotNetCore.AspNetCore, 0.1.0"
#:package ReactDotNetCore.AspNetCore@0.1.0
#addin nuget:?package=ReactDotNetCore.AspNetCore&version=0.1.0
#tool nuget:?package=ReactDotNetCore.AspNetCore&version=0.1.0
ReactDotNetCore.AspNetCore
Use React components as ASP.NET Core MVC views — server-side rendered and hydrated — without a separate Web API, Next.js app, or SPA. Keep your existing controllers, services, repositories, and view models; replace only the view layer.
public IActionResult Detail(int id)
{
var model = _userService.GetUser(id); // unchanged domain code
return this.ReactView<UserProfile>(model);
}
// Views/UserProfile.tsx
export default function UserProfile(props: UserDto) {
return <h1>{props.name}</h1>;
}
How it works
A controller returns a ReactDotNetCoreResult. The engine serializes the model to camelCase JSON props,
asks a managed Node SSR sidecar to render the component to HTML, and returns a full page with
the markup, the embedded props, and the hydration script. The browser hydrates with the same
component + props.
- Production: the sidecar imports the Vite-built SSR bundle; the page links hashed assets from the Vite manifest.
- Development: the sidecar runs a Vite dev server, rendering on the fly with HMR — edit a
.tsxand the browser hot-reloads, no rebuild.
The companion npm package @react-dotnetcore/runtime
provides the JS side (registry, SSR renderer, hydration, sidecar).
Setup
builder.Services.AddReactDotNetCore(); // options: dev mode, ports, timeouts, paths, JSON
app.UseStaticFiles(); // serves the built client assets from wwwroot
Production hardening built in: auto free-port selection, sidecar health-gating, crash auto-restart,
render timeouts, graceful shutdown, loopback-only sidecar, safe <script> props escaping, and no
SSR stack-trace leakage in Production.
See the repository README for the full walkthrough, project structure, and the sample app.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.