You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/jekyll/guides/server-side-rendering.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,3 +72,26 @@ meaning your initial render will be super fast.
72
72
73
73
For a more in-depth example, take a look at the included sample application
74
74
(**React.Samples.Mvc4**).
75
+
76
+
5 - Server-side only rendering
77
+
78
+
If there is no need to have a React application client side and you just want to use the server side rendering but without the React specific data attributes call `Html.React` and pass serverOnly parameter as true.
79
+
80
+
```csharp
81
+
@Html.React("HelloWorld", new
82
+
{
83
+
name="Daniel"
84
+
}
85
+
serverOnly:true)
86
+
```
87
+
88
+
And the Html mark up will look like the one following which is a lot cleaner. In this case there is no need to load the React script or call the `Html.ReactInitJavaScript()` method.
Copy file name to clipboardExpand all lines: src/React.Core/IReactComponent.cs
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
* All rights reserved.
4
4
*
5
5
* This source code is licensed under the BSD-style license found in the
6
-
* LICENSE file in the root directory of this source tree. An additional grant
6
+
* LICENSE file in the root directory of this source tree. An additional grant
7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
@@ -39,12 +39,13 @@ public interface IReactComponent
39
39
/// return the rendered HTML.
40
40
/// </summary>
41
41
/// <param name="renderContainerOnly">Only renders component container. Used for client-side only rendering.</param>
42
+
/// <param name="renderServerOnly">Only renders the common HTML mark up and not any React specific data attributes. Used for server-side only rendering.</param>
Copy file name to clipboardExpand all lines: src/React.Core/ReactComponent.cs
+13-11Lines changed: 13 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
* All rights reserved.
4
4
*
5
5
* This source code is licensed under the BSD-style license found in the
6
-
* LICENSE file in the root directory of this source tree. An additional grant
6
+
* LICENSE file in the root directory of this source tree. An additional grant
7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
@@ -79,18 +79,20 @@ public ReactComponent(IReactEnvironment environment, IReactSiteConfiguration con
79
79
/// return the rendered HTML.
80
80
/// </summary>
81
81
/// <param name="renderContainerOnly">Only renders component container. Used for client-side only rendering.</param>
82
+
/// <param name="renderServerOnly">Only renders the common HTML mark up and not any React specific data attributes. Used for server-side only rendering.</param>
0 commit comments