Inertia.React 0.1.1

dotnet add package Inertia.React --version 0.1.1
                    
NuGet\Install-Package Inertia.React -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Inertia.React" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Inertia.React" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Inertia.React" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Inertia.React --version 0.1.1
                    
#r "nuget: Inertia.React, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Inertia.React@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Inertia.React&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Inertia.React&version=0.1.1
                    
Install as a Cake Tool

Inertia.React

NuGet License

React adapter for Inertia.js on ASP.NET Core

Build modern React applications with server-side rendering support using Inertia.js and ASP.NET Core.

Installation

dotnet add package Inertia.React

Quick Start

1. Configure Services

using Inertia.React;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllersWithViews();
builder.Services.AddInertiaReact(options =>
{
    options.Version = "1.0.0";
    options.RootView = "_Inertia";
});

var app = builder.Build();
app.UseInertia();
app.MapControllers();
app.Run();

2. Create React Components

Create wwwroot/js/pages/Home/Index.jsx:

import React from 'react';

export default function Index({ message, users }) {
  return (
    <div>
      <h1>{message}</h1>
      <ul>
        {users.map(user => (
          <li key={user.id}>{user.name}</li>
        ))}
      </ul>
    </div>
  );
}

3. Initialize Inertia App

Create wwwroot/js/app.jsx:

import { createInertiaApp } from '@inertiajs/react';
import { createRoot } from 'react-dom/client';

const pages = import.meta.glob('./pages/**/*.jsx', { eager: true });

const resolve = (name) => {
  return pages[`./pages/${name}.jsx`]?.default;
};

createInertiaApp({
  resolve,
  setup({ el, App, props }) {
    createRoot(el).render(<App {...props} />);
  },
});

Server-Side Rendering (SSR)

Enable SSR for better initial load times and SEO:

builder.Services.AddInertiaReact(options =>
{
    options.EnableSSR = true;
    options.SSREndpoint = "http://localhost:13714/render";
});

Create an SSR server using Node.js:

// ssr.js
import { createInertiaApp } from '@inertiajs/react';
import createServer from '@inertiajs/react/server';
import ReactDOMServer from 'react-dom/server';

const pages = import.meta.glob('./pages/**/*.jsx', { eager: true });

createServer((page) =>
  createInertiaApp({
    page,
    resolve: (name) => pages[`./pages/${name}.jsx`],
    render: ReactDOMServer.renderToString,
    setup({ App, props }) {
      return <App {...props} />;
    },
  })
);

Features

  • React Integration - Full React support with hooks and components
  • SSR Support - Built-in server-side rendering via HTTP endpoint
  • Component Auto-Discovery - Automatic component resolution by name
  • TypeScript Support - Included type definitions for Inertia page props

Project Structure

Inertia.React/
├── src/
│   ├── ReactSSRRenderer.cs      # HTTP-based SSR implementation
│   └── ReactInertiaExtensions.cs # Service registration extensions
├── contentFiles/
│   └── js/
│       └── types.d.ts           # TypeScript definitions
└── Inertia.React.csproj

TypeScript Support

The package includes TypeScript definitions for Inertia page data:

import { PageProps } from '@inertiajs/react';

interface DashboardProps extends PageProps {
  user: { name: string };
  stats: { users: number };
}

export default function Dashboard({ user, stats }: DashboardProps) {
  // ...
}

Testing

Run the test suite:

dotnet test tests/Inertia.React.Tests

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

Support

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 85 5/27/2026