.NET Core 2.2 Web API, React, and Google V8

409 Views Asked by At

We've decided to use React for our UI work within NET CORE.

Per the React URL: https://reactjs.net/getting-started/aspnetcore.html , we "also need to install a JS engine to use (either V8 or ChakraCore are recommended)"

We decided to go with Google V8 (since we use Chrome bunches more than Edge), but we're having a hard time figuring out what needs to be installed - there are many "V8" images available in the NUGET repository.

Question #1 : What V8 components need to be installed to get React working?

Question #2 : Does it really matter with respect to using Google V8 or ChakraCore? Per the URL, the sample code provided uses Chakra...

1

There are 1 best solutions below

0
On

Response to Question #1 -

I'm assuming that you intend to render React components server side using Google V8. Unfortunately, the only V8 JavaScript engine that is supported by ReactJs.NET (JSPool and JavaScriptEngineSwitcher) is Microsoft's ClearScript library which wraps V8 in a mixed mode .NET assembly.

Currently mixed mode assemblies aren't supported by .NET Core. Apparently that's coming in .NET Core 3.1. At which time the ClearScript team will have to rebuild the library. You can follow along at the source here.

Response to Question #2 -

My testing has shown that ClearScript V8 is much faster (by a factor of 4 with "complex" React components) than the ChakraCore library that is distributed. Other than that, you'd probably not notice a difference.