Skip to content

Commit 45fbcea

Browse files
committed
Update documentation
1 parent 1d78f27 commit 45fbcea

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

Docs/README.MD

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SSR.Net
33
============
44

5-
SSR.Net enables you to Server-Side Render (SSR) components in React 17, React 18 and Vue 3 in .Net Framework/Core/5/6/7/8/9. It is open for extension and can support other frontend frameworks. It aims at being a performant, minimalistic way to support SSR in .Net.
5+
SSR.Net enables you to Server-Side Render (SSR) components in React 17, React 18, React 19 and Vue 3 in .Net Framework/Core/5/6/7/8/9. It is open for extension and can support other frontend frameworks. It aims at being a performant, minimalistic way to support SSR in .Net.
66

77
It is based on many of the ideas in ReactJS.Net: https://github.com/reactjs/React.NET.
88

@@ -16,11 +16,11 @@ This library can be installed through NuGet. You will also need to install a Jav
1616
## Configuration and usage
1717

1818
The easiest way to get started is to copy or look at one of the example projects:
19-
* For .Net Framework: https://github.com/knowit/SSR.Net/tree/main/src/SSR.Net.DotNetFramework
20-
* For .Net 8: https://github.com/knowit/SSR.Net/tree/main/src/SSR.Net.DotNet8
21-
* Example frontend for React 18: https://github.com/knowit/SSR.Net/tree/main/src/Frontend/React18Source
22-
* Example frontend for React 17: https://github.com/knowit/SSR.Net/tree/main/src/Frontend/React17Source
23-
* Example frontend for Vue 3: https://github.com/knowit/SSR.Net/tree/main/src/Frontend/Vue3Source
19+
* For .Net Framework: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/SSR.Net.DotNetFramework
20+
* For .Net 8: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/SSR.Net.DotNet8
21+
* Example frontend for React 18: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/Frontend/React18Source
22+
* Example frontend for React 17: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/Frontend/React17Source
23+
* Example frontend for Vue 3: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/Frontend/Vue3Source
2424

2525
To build frontend, just run the build scripts in package.json.
2626

@@ -33,9 +33,9 @@ We will look at how to do this for React 18 and .Net 8 in the following chapters
3333

3434
### Building a JavaScript bundle fit for SSR
3535

36-
We start by creating a bundle with some components. For React 18, there is an example here: https://github.com/knowit/SSR.Net/tree/main/src/Frontend/React18Source
36+
We start by creating a bundle with some components. For React 18, there is an example here: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/Frontend/React18Source
3737

38-
We will create a FrontPage component for this example (source code here: https://github.com/knowit/SSR.Net/blob/main/src/Frontend/React18Source/src/Components/FrontPage.tsx).
38+
We will create a FrontPage component for this example (source code here: https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/Frontend/React18Source/src/Components/FrontPage.tsx).
3939

4040
```
4141
import React, { useState } from "react";
@@ -80,7 +80,7 @@ export default FrontPage;
8080
This component has a simple expand/collapse function. This will show us that React is actually working interactively on the client side.
8181

8282
We then create an entry point for our bundle. Here, we expose the React, ReactDOMServer and ReactDOMClient libraries as global variables. We also expose the components we've created. It works well to just import them all and add them to a global Components variable. See an example of how this is done here:
83-
https://github.com/knowit/SSR.Net/blob/main/src/Frontend/React18Source/src/app.tsx
83+
https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/Frontend/React18Source/src/app.tsx
8484

8585
```
8686
import * as React from 'react'
@@ -95,7 +95,7 @@ globalThis.ReactDOMClient = ReactDOMClient;
9595
globalThis.Components = {FrontPage, ArticlePage};
9696
```
9797

98-
In this simple example we use esbuild alone to build the bundle, but it's no problem to use Webpack. You can also use Vite, but you will need to turn off the built in minification and find a different way of minifying it, otherwise the global variables will be removed from the bundle during tree shaking. The esbuild command we use is in the package.json (https://github.com/knowit/SSR.Net/blob/main/src/Frontend/React18Source/package.json):
98+
In this simple example we use esbuild alone to build the bundle, but it's no problem to use Webpack. You can also use Vite, but you will need to turn off the built in minification and find a different way of minifying it, otherwise the global variables will be removed from the bundle during tree shaking. The esbuild command we use is in the package.json (https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/Frontend/React18Source/package.json):
9999

100100
```
101101
"scripts": {
@@ -110,14 +110,14 @@ We run this through npm:
110110
npm run build-dotnet8
111111
```
112112

113-
The resulting js bundle is built to the wwwroot folder in the DotNet8 project as react18example.js: https://github.com/knowit/SSR.Net/tree/main/src/SSR.Net.DotNet8/wwwroot
113+
The resulting js bundle is built to the wwwroot folder in the DotNet8 project as react18example.js: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/SSR.Net.DotNet8/wwwroot
114114

115115
### Set up a web project
116116

117-
Let's look at this example web project: https://github.com/knowit/SSR.Net/tree/main/src/SSR.Net.DotNet8
117+
Let's look at this example web project: https://github.com/Knowit-Objectnet/SSR.Net/tree/main/src/SSR.Net.DotNet8
118118

119119
We have an extension method for adding a React18Renderer to IoC, which is the normal way of adding things to .Net Core and forward:
120-
https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/Services/ServiceCollectionExtensionsReact18SSR.cs
120+
https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/SSR.Net.DotNet8/Services/ServiceCollectionExtensionsReact18SSR.cs
121121

122122
```
123123
using JavaScriptEngineSwitcher.V8;
@@ -145,7 +145,7 @@ The code above adds both a server-side polyfill named React18TextEncoderPolyfill
145145
We use the V8 JavaScript engine in this example. This, and the scripts, is configured in a JavaScriptEnginePool. This pool will manage JavaScript engines, create new ones proactively, dispose exhausted engines and forward the rendering calls to the JavaScript engines.
146146

147147
To make this work, we have to reference some packages in our web project:
148-
https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/SSR.Net.DotNet8.csproj
148+
https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/SSR.Net.DotNet8/SSR.Net.DotNet8.csproj
149149

150150
```
151151
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.19.0" />
@@ -155,7 +155,7 @@ https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/SSR.Net.DotNet8.
155155
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x86" Version="7.3.7" />
156156
```
157157

158-
After this is done, we call the extension method during the initialization of our program in Program.cs: https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/Program.cs
158+
After this is done, we call the extension method during the initialization of our program in Program.cs: https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/SSR.Net.DotNet8/Program.cs
159159

160160
```
161161
builder.Services.AddReact18Renderer(builder.Environment);
@@ -164,7 +164,7 @@ builder.Services.AddReact18Renderer(builder.Environment);
164164

165165
### Set up a controller and a view
166166

167-
To do the actual Server-Side Rendering, we need to serialize props for the React component we want to Server-Side Render and send the props as JSON to the React18Renderer, together with the component name. In this simplified example, we do this directly in the controller (https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/Controllers/HomeController.cs).
167+
To do the actual Server-Side Rendering, we need to serialize props for the React component we want to Server-Side Render and send the props as JSON to the React18Renderer, together with the component name. In this simplified example, we do this directly in the controller (https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/SSR.Net.DotNet8/Controllers/HomeController.cs).
168168

169169
First, we inject the React18Renderer in the controller (some lines are removed for brevity and clarity):
170170

@@ -203,7 +203,7 @@ public ActionResult React18() {
203203
}
204204
```
205205

206-
The view is kept very simple (https://github.com/knowit/SSR.Net/blob/main/src/SSR.Net.DotNet8/Views/Home/React18.cshtml):
206+
The view is kept very simple (https://github.com/Knowit-Objectnet/SSR.Net/blob/main/src/SSR.Net.DotNet8/Views/Home/React18.cshtml):
207207

208208
```
209209
@using SSR.Net.Models;

src/SSR.Net/Docs/README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ It has DLLs for .Net Standard 2.0 and .Net 7/8/9 to support everything from .Net
99

1010
Performance is optimized through proactive JavaScript engine preparation, engine reuse and smart scheduling.
1111

12-
See examples and read more in the documentation on GitHub: https://github.com/knowit/SSR.Net
12+
See examples and read more in the documentation on GitHub: https://github.com/Knowit-Objectnet/SSR.Net
1313

1414
It is based on many of the ideas in ReactJS.Net: https://github.com/reactjs/React.NET

src/SSR.Net/SSR.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;net7.0;net8.0;net9.0</TargetFrameworks>
44
<PackageId>SSR.Net</PackageId>
5-
<Version>1.0.5</Version>
5+
<Version>1.1.3</Version>
66
<Authors>Øivind Hagen</Authors>
77
<Company>Knowit AS</Company>
88
<Product>SSR.Net</Product>

0 commit comments

Comments
 (0)