Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 3.44 KB

README.md

File metadata and controls

76 lines (59 loc) · 3.44 KB

JsxCore documentation

A TSX/JSX view engine for ASP.NET Core. To get running, start with Getting started. The rest is reference material to read when you need it.

← Back to the project README


Getting started

Getting started Prerequisites, installation, your first view, project layout
For frontend developers Coming from Next.js or a Vite SPA: what maps onto what, and where server and client code live
How it works The compilation pipeline, native ESM, where the packages come from, build ids, the embedded runtime

Using it

Runtimes Preact, which ships inside JsxCore, upgrading it, switching to React, and React compatibility
Render modes Client, server, or both, and what changes in each
Writing views The view contract, component imports, head, hooks, the JSX dialect
Import syntax Every import a view can write, and what each one resolves to
Model types TypeScript types generated from your .NET models, and how to control what is exported
Views and Web APIs A page server rendered for first paint that then talks to your own API
Returning views Minimal APIs, MVC controllers, per-response document settings
Styling Stylesheets, CSS Modules, Tailwind, and where each file lives
npm packages Importing packages from node_modules, on the server and in the browser
Package management Installing packages without npm, and the dotnet npm tool
.NET interop Calling .NET objects directly from server-rendered views

Operating it

Development Hot reload, editor support, and the framework diagnostic header
Build and deploy The three build modes, type-checking strictness, minification and compression, publishing without npm
Testing WebApplicationFactory, TestServer, and the content-root gotcha

Reference

Extensibility Document templates, ambient context, import maps, view locations, compiler options
Configuration Every option, and every MSBuild property
Content Security Policy Supplying a nonce for the scripts JsxCore writes
Troubleshooting Common errors, and the limitations to know about up front
Roadmap What is not built yet, in the order it would be built
Changelog What changed between versions
Contributing Building the repository, its layout, and how to propose a change

The short version

dotnet add package JsxCore
builder.AddJsxCore();
app.UseJsxCore();
app.MapGet("/", () => Results.Extensions.Jsx("Home/Index", new { name = "World" }));
// Views/Home/Index.tsx
export default function Index({ model }: { model: { name: string } }) {
    return <h1>Hello {model.name}</h1>;
}

No bundler, no Node.js process, no hand-written model interfaces, and nothing installed but the .NET SDK.