Description
First off thank you for this project, really great!
We wanted to server side render components built in Create React App + TypeScript in our ASP.NET MVC 4 web page. We have gotten it working great but the documentation was missing a lot of things slowing us down. After a lot of trial and error, reading github issues and more I finally created this sample repo: https://github.com/johot/reactjs.net-asp-mvc4-cra-typescript-parcel with my findings.
It has a guide on how to get components from a TypeScript create-react-app projects working server + client side using ReactJS.NET. Also we use parcel for bundling since we wanted a zero config setup, this worked out great and could perhaps be a good fit for the ReactJS.net documentation.
I unfortunately don't have the time to do PRs to this project right now, but maybe parts of my guide can be of help to others.
Anyways the things I wish was mentioned in the documentation are primarily these:
- Without adding
JavaScriptEngineSwitcher.V8.Native.win-x86
we could not get it working (C++ redist needed?) - The need for
SetLoadReact(false)
to make hooks work. Also something mentioning whatSetLoadReact
is used for and how it allows us to bundle React ourselves (we had to find this through github issues). - If mentioning
SetLoadReact(false)
also explain thatReactDom
etc needs to be exposed through the use ofglobal
. - To make things work client side you must also load the script bundle client side with a
<script/>
tag (this is not mentioned in the server side docs).
Thank you!