ReactJS.NET 2.1

November 16, 2015 by Daniel Lo Nigro


I'm happy to announce the release of ReactJS.NET 2.1! This is a minor release, and includes a number of changes and fixes since 2.0:

  • #189 - If errors occur while loading a JS file, don't throw an exception until we actually try to use the script. This ensures that a syntax error in a file loaded with AddScriptWithoutTransform will not crash IIS.
  • #186 - Expose ReactDOM just in case it's used in some script.
  • #182 - Use SHA1 rather than MD5 for cache hashing so that it can be used in a FIPS-compliant environment. Thanks to Ruaidhri Primrose
  • Added a console sample to show how ReactJS.NET can be used outside of a web context.
  • #195 - Add ReactEnvironment.Current property as a shortcut to get the current React environment. This replaces the old method of directly using the DI container (React.AssemblyRegistration.Container.Resolve<IReactEnvironment>()).

Have fun, and as always, please feel free to send feedback or bug reports on GitHub.

— Daniel

ReactJS.NET 2.0 - Babel and React 0.14

October 17, 2015 by Daniel Lo Nigro


I'm happy to announce the release of ReactJS.NET 2.0! The major change in this release is the switch from JSXTransformer to Babel for transformation of JavaScript files. JSXTransformer is now deprecated, and Babel supports many more ES6 features than JSXTransformer did (see the Babel site for a full list). Additionally, syntax error messages are now more detailed and display the correct file name and line number.

Full list of changes:

  • #138 - Use Babel to transform JavaScript files.
  • #171 - Updated ASP.NET 5 integration to support Beta 8.
  • #164 - Upgraded to React 0.14.
  • By default, only handle *.jsx files in ASP.NET 5 and OWIN middleware. You can modify the Extensions setting in BabelFileOptions to change this behaviour.

Under the hood:

  • #168 - Everything relating to JSX transformer has been renamed to Babel (eg. IJsxTransformer is now IBabel).
  • Renamed React assembly to React.Core. The NuGet package has been called "React.Core" forever, but the corresponding assembly name didn't match, resulting in confusion.
  • Deprecated IReactEnvironment.TransformJsxFile and IReactEnvironment.TransformJsx have finally been removed. These methods have been obsolete since ReactJS.NET 0.2.

Have fun, and as always, please feel free to send feedback or bug reports on GitHub.

— Daniel

ReactJS.NET 1.5.1 - Security update

April 23, 2015 by Daniel Lo Nigro


I'm happy to announce the release of ReactJS.NET 1.5.1! This is a bug fix release and fixes a potential XSS issue with server-side rendering. JSON.NET does not escape HTML characters in its JSON output by default. As ReactJS.NET uses JSON.NET to output the props of server-side rendered components, a prop that accepts arbitrary user input could potentially contain script tags, allowing for XSS.

Escaping of HTML is now enabled by default. If you are using custom JSON serializer settings, you can enable HTML escaping by setting StringEscapeHandling to StringEscapeHandling.EscapeHtml:

ReactSiteConfiguration.Configuration.SetJsonSerializerSettings(
  new JsonSerializerSettings
  {
    StringEscapeHandling = StringEscapeHandling.EscapeHtml
  }
);

Have fun, and as always, please feel free to send feedback or bug reports on GitHub.

— Daniel

Thanks to Li Huan Jeow for the report.

ReactJS.NET 1.5

April 13, 2015 by Daniel Lo Nigro


I'm happy to announce the release of ReactJS.NET 1.5! This is a minor release and includes a number of changes and fixes since version 1.4:

  • #93 - Upgraded React to 0.13.1. See the full changelog on the React site.
  • #91 - Method to load a script without transforming it. It's becoming more and more common to use external build systems (Gulp, Grunt) or bundlers (Webpack, Browserify) that handle the JSX transformation. The output of these can be loaded directly into ReactJS.NET as it's just vanilla JavaScript. AddScriptWithoutTransform makes loading these files more efficient by just loading them directly.
  • New option to disable the MSIE JavaScript engine and force use of the V8 engine. If V8 can't be initialised for whatever reason, an exception is thrown.
  • #103 - Flag for RenderHtml to skip server-side rendering and only render the client-side JavaScript. Useful for debugging the JavaScript in a browser. Thanks Justin Slattery.
  • #60 - Scripts can now be loaded using wildcard patterns: .AddScript("~/Content/*.js").
  • #113 - Ability to provide your own React version rather than using the bundled version.
  • #104 - Correctly handle exceptions in ExecuteWithLargerStackIfRequired, and upgrade to latest Newtonsoft.Json to fix issue with MSBuild.
  • Upgraded to JSPool 0.3 for better handling of recycling the JavaScript engines when a file changes.
  • Created missing React.Owin NuGet package.

Have fun, and as always, please feel free to send feedback or bug reports on GitHub.

— Daniel

ReactJS.NET 1.4 - Support for ASP.NET 5

March 2, 2015 by Daniel Lo Nigro


I'm happy to announce the release of ReactJS.NET 1.4! This release adds support for the beta version of ASP.NET 5, better handling of server-side console.log calls, and the V8 JavaScript engine is now included as standard (the MSIE engine is still available for use, though).

Full list of changes:

  • #47 and #94Support for ASP.NET 5. You must be using Visual Studio 2015 CTP6 and ASP.NET 5 Beta 3. Documentation will be added to the site shortly.
  • #86console calls such as console.log during server-side rendering will automatically be propagated to the client-side. This can greatly assist in debugging server-side rendering. Nicer debugging tools will come in the future!
  • #96 — Bundle V8 support by default, stop relying on MSIE engine as much.
  • #97 — Upgrade to JSPool 0.2. This improves the handling of JavaScript engines by recycling them after a number of uses, which ensures memory usage doesn't keep growing over time.
  • #89 — Fixed "Object doesn't support property or method 'defineProperty'" with MSIE engine when using Flow types.
  • #69 — Support for OWIN. Thanks to Marcin Drobik.
  • #70 — JsxTransformer exceptions now include whole inner exception. Thanks to Marcin Drobik.
  • #84 — Fixed missing strong name on System.Web.Optimization.React and React.MSBuild.
  • #67 — ReactJS.NET website now has a fancy logo. Thanks Rick Beerendonk!

Have fun, and as always, please feel free to send feedback or bug reports on GitHub.

— Daniel