Skip to content

Commit ba1facc

Browse files
Move tutorial source into installable template (reactjs#1049)
* Move tutorial source into installable template * Add template to getting started pages * Fix template package versioning
1 parent 0dc3334 commit ba1facc

File tree

25 files changed

+73
-7
lines changed

25 files changed

+73
-7
lines changed

build.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ of patent rights can be found in the PATENTS file in the same directory.
3131
<PackageAssemblies Include="React.Router.Mvc4" />
3232
<PackageAssemblies Include="React.Web" />
3333
<PackageAssemblies Include="React.Web.Mvc4" />
34+
<PackageAssemblies Include="React.Template" />
3435
<PackageAssemblies Include="System.Web.Optimization.React" />
3536
</ItemGroup>
3637

site/jekyll/_posts/2016-10-09-3.0.0-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ layout: post
44
author: Daniel Lo Nigro
55
---
66

7-
I'm happy to announce the release of ReactJS.NET 3.0! The major change in this release is the addition of support for .NET Core! [The tutorial](/tutorials/aspnetcore.html) has also been totally revamped for ASP.NET Core, and a completed version of the tutorial code is now [available in the ReactJS.NET Git repository](https://github.com/reactjs/React.NET/tree/master/tutorial-code)
7+
I'm happy to announce the release of ReactJS.NET 3.0! The major change in this release is the addition of support for .NET Core! [The tutorial](/tutorials/aspnetcore.html) has also been totally revamped for ASP.NET Core, and a completed version of the tutorial code is now [available in the ReactJS.NET Git repository](https://github.com/reactjs/React.NET/tree/master/src/React.Template/reactnet-vanilla)
88

99
**Major Changes**:
1010

site/jekyll/_posts/2019-11-24-5.1.2-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: Dustin Masters
66

77
🚀 We're pleased to announce the release of ReactJS.NET 5.1.2. A few small updates in this release:
88

9-
- .NET Core 3.0 support. The [tutorial project](https://github.com/reactjs/React.NET/tree/master/tutorial-code) has also been updated to demonstrate the (simple!) migration path.
9+
- .NET Core 3.0 support. The [tutorial project](https://github.com/reactjs/React.NET/tree/master/src/React.Template/reactnet-vanilla) has also been updated to demonstrate the (simple!) migration path.
1010
- React and ReactDOM updated to 16.12.0
1111
- Fix missing query parameter mapping for React.Router - thanks [@mattywong](https://github.com/mattywong)
1212

site/jekyll/getting-started/aspnetcore.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ title: Getting Started (ASP.NET Core)
66

77
#### 👀 Just want to see the code? Check out the [sample project](https://github.com/reactjs/React.NET/tree/master/src/React.Sample.Webpack.CoreMvc).
88

9+
## For new projects:
10+
11+
```
12+
dotnet new -i React.Template
13+
dotnet new reactnet-vanilla
14+
dotnet run
15+
```
16+
17+
## For existing projects:
18+
919
This guide covers enabling server-side rendering and Babel compilation. Getting started with ReactJS.NET on ASP.NET Core requires a few more steps compared to previous versions of ASP.NET and MVC. If you want a step-by-step guide on configuring a brand new site, see [the ReactJS.NET tutorial for ASP.NET Core](/tutorials/aspnetcore.html).
1020

1121
ReactJS.NET requires at least Visual Studio 2015 and ASP.NET Core 1.0, but has also been tested with VS 2017 and .NET Core 2.1.

site/jekyll/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bundles.Add(new JsxBundle("~/bundles/main").Include(
131131
<hr class="home-divider" />
132132
<section class="home-bottom-section">
133133
<div class="buttons-unit">
134-
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fgetting-started%2F%3Cspan+class%3D"x x-first x-last">download.html" class="button">Get Started</a>
134+
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fgetting-started%2F%3Cspan+class%3D"x x-first x-last">aspnetcore.html" class="button">Get Started</a>
135135
<a href="/tutorials/aspnetcore" class="button">Tutorial</a>
136136
</div>
137137
</section>

site/jekyll/tutorials/aspnetcore.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ layout: docs
88
>
99
> This tutorial is for Visual Studio 2019 and ASP.NET Core MVC. If you're still using ASP.NET 4 and ASP.NET MVC 5, you can [follow the ASP.NET 4 tutorial instead](/tutorials/aspnet4.html)
1010
11+
## Quick start
12+
13+
```
14+
dotnet new -i React.Template
15+
dotnet new reactnet-vanilla
16+
dotnet run
17+
```
18+
19+
## Step by step version
20+
1121
This tutorial covers the end-to-end process of creating a brand new ASP.NET MVC website and adding a React component in it. We will start from scratch and end with a fully functioning component. It assumes you have basic knowledge of ASP.NET MVC and using Visual Studio. This tutorial is based off the [original React tutorial](https://reactjs.org/tutorial/tutorial.html) but has been modified specifically for ReactJS.NET.
1222

1323
We'll be building a simple, but realistic comments box that you can drop into a blog, a basic version of the realtime comments offered by Disqus, LiveFyre or Facebook comments.
@@ -26,7 +36,7 @@ It'll also have a few neat features:
2636

2737
## Want to skip all this and see the source?
2838

29-
[It's all on GitHub](https://github.com/reactjs/React.NET/tree/master/tutorial-code).
39+
[It's all on GitHub](https://github.com/reactjs/React.NET/tree/master/src/React.Template/reactnet-vanilla).
3040

3141
## Getting started
3242

@@ -1011,7 +1021,7 @@ There used to be a section on bundling and minification in this tutorial, but un
10111021

10121022
Server-side rendering means that your application initially renders the components on the server-side, rather than fetching data from the server and rendering using the client. Server-side rendering enhances the performance of your application since the user will see the initial state immediately.
10131023

1014-
We need to make some modifications to `CommentBox` to support server-side rendering. Firstly, we need to accept an `initialData` prop, which will be used to set the initial state of the component, rather than doing an AJAX request. We also need to remove the initial `loadCommentsFromServer` call from `componentDidMount`, since it is no longer required.
1024+
We need to make some modifications to `CommentBox` to support server-side rendering. Firstly, we need to accept an `initialData` prop, which will be used to set the initial state of the component, rather than doing an AJAX request. We also need to remove the initial `loadCommentsFromServer` call from `componentDidMount`, since it is no longer required.
10151025

10161026
```javascript{4,31-33}
10171027
class CommentBox extends React.Component {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PackageType>Template</PackageType>
5+
<PackageId>React.Template</PackageId>
6+
<PackageProjectUrl>https://github.com/reactjs/react.net</PackageProjectUrl>
7+
<PackageLicense>https://github.com/reactjs/React.NET#licence</PackageLicense>
8+
<Title>ReactJS.NET Template Pack</Title>
9+
<Authors>ReactJS.NET contributors</Authors>
10+
<Description>Templates to use for bootstrapping new ReactJS.NET applications.</Description>
11+
<PackageTags>dotnet-new;templates;react</PackageTags>
12+
13+
<TargetFramework>netstandard2.0</TargetFramework>
14+
15+
<IncludeContentInPack>true</IncludeContentInPack>
16+
<IncludeBuildOutput>false</IncludeBuildOutput>
17+
<ContentTargetFolders>content</ContentTargetFolders>
18+
</PropertyGroup>
19+
20+
<ItemGroup>
21+
<Content Include="reactnet-vanilla\**\*" Exclude="reactnet-vanilla\**\bin\**;reactnet-vanilla\**\obj\**" />
22+
<Compile Remove="**\*" />
23+
</ItemGroup>
24+
25+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"author": "ReactJS.NET contributors",
3+
"classifications": [
4+
"Web"
5+
],
6+
"name": "React.NET Starter Template",
7+
"identity": "React.Template.NetCore",
8+
"shortName": "reactnet-vanilla",
9+
"tags": {
10+
"language": "C#"
11+
},
12+
"preferNameDirectory": "true"
13+
}

tutorial-code/Controllers/HomeController.cs renamed to src/React.Template/reactnet-vanilla/Controllers/HomeController.cs

File renamed without changes.

tutorial-code/Models/CommentModel.cs renamed to src/React.Template/reactnet-vanilla/Models/CommentModel.cs

File renamed without changes.

0 commit comments

Comments
 (0)