ReactJS.NET v5.2 Release Notes
Release Date: 2020-06-19 // about 4 years ago-
๐ ๐ We're pleased to announce the release of ReactJS.NET 5.2. In this release:
Templates
โก๏ธ This update contains a brand new feature - templates! This feature makes it much easier to get started on a new project.
To start a new ASP.NET Core project using React and server-side rendering:
dotnet new -i React.Template dotnet new reactnet-webpack dotnet run
The
reactnet-vanilla
template is also available for projects that don't need webpack.๐ Webpack Asset Manifest Support
๐ If you've ever wanted to use hashes in the filenames of generated assets, this feature is for you! When using Webpack and
webpack-manifest-plugin
, it's now possible to render the script and style tags automatically from the generated asset manifest. This can be especially helpful when using caching headers to instruct the client not to refetch these static assets from the server.If using the filename pattern
'[name].[contenthash:8].js'
, webpack will emit files that look like this:vendor.8faee7f5.js main-0c14766b.js
๐ง Configure reading these files server-side with
config.SetReactAppBuildPath("~/dist");
wheredist
is the directory where webpack emits the built assets.In your view code, call:
@Html.ReactGetStylePaths() // in the doucment head next to other stylesheets @Html.ReactGetScriptPaths() // right before the body closing tag
Next, define an asset manifest format in your webpack config. Check out the sample webpack config for the format the asset manifest is expected to follow.
๐ At render time, the asset manifest will be read from the
dist
directory and be mapped intoscript
andstyle
tags for the browser to download.The
reactnet-webpack
sample uses this layout, so give it a try if you're curious!Thanks
If this library has made a difference to you in either a work or personal project, I'd love to hear from you. We don't get paid at all to work on this, it's just for fun! Drop a line @dustinsoftware or @Daniel15
Cheers,
Dustin
Previous changes from v5.1.2
-
๐ ๐ We're pleased to announce the release of ReactJS.NET 5.1.2. A few small updates in this release:
- โก๏ธ .NET Core 3.0 support. The tutorial project has also been updated to demonstrate the (simple!) migration path.
- โก๏ธ React and ReactDOM updated to 16.12.0
- ๐ Fix missing query parameter mapping for React.Router - thanks @mattywong
Please report any bugs in the issue tracker.
Cheers!