Skip to content

Commit 59c2136

Browse files
committed
Add documentation on how not to render the React data attributes
1 parent e7c26db commit 59c2136

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

site/jekyll/guides/server-side-rendering.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,26 @@ meaning your initial render will be super fast.
7272

7373
For a more in-depth example, take a look at the included sample application
7474
(**React.Samples.Mvc4**).
75+
76+
5 - How not to render the React data attributes
77+
78+
If thre 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 renderReactAttributes parameter as false.
79+
80+
```csharp
81+
@Html.React("HelloWorld", new
82+
{
83+
name = "Daniel",
84+
renderReactAttributes: false
85+
})
86+
```
87+
88+
And the Html markup will look like which is a lot cleaner. In this case there is no need to laod the React script or call the `Html.ReactInitJavaScript()` method.
89+
90+
```html
91+
<div id="react1">
92+
<div>
93+
<span>Hello </span>
94+
<span>Daniel</span>
95+
</div>
96+
</div>
97+
```

0 commit comments

Comments
 (0)