forked from reactjs/React.NET
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIndex.cshtml
27 lines (25 loc) · 1.03 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
27
@using React.AspNet
@model React.Sample.Mvc6.ViewModels.IndexViewModel
<!DOCTYPE html>
<html>
<head>
<title>ReactJS.NET Sample</title>
<link rel="stylesheet" href="~/css/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("CommentsBox", new { initialComments = Model.Comments })
<!-- Load all required scripts (React + the site's scripts) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.0.0/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.0.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="~/js/Sample.jsx"></script>
<!-- Render the code to initialise the component -->
@Html.ReactInitJavaScript()
</body>
</html>