forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.cshtml
26 lines (24 loc) · 1.06 KB
/
Index.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@model React.Sample.Mvc4.ViewModels.IndexViewModel
<!DOCTYPE html>
<html>
<head>
<title>ReactJS.NET Webpack Sample</title>
<link rel="stylesheet" href="~/Content/Sample.css" />
</head>
<body>
<p>
This is an example of ReactJS.NET's server-side rendering. The initial state of this
comments box is rendered server-side, and additional data is loaded via AJAX and rendered
client-side.
</p>
<!-- Render the component server-side, passing initial props -->
@Html.React("Components.CommentsBox", new { initialComments = Model.Comments })
<!-- Load all required scripts (React + the site's scripts) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.0/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script>
<script src="@Url.Content("~/build/client.bundle.js")"></script>
<!-- Render the code to initialise the component -->
@Html.ReactInitJavaScript()
</body>
</html>