Reputation: 325
I use my own .NET web server and would like to pre-render web pages which are build on React.js. I was seaking a way to do it, but the only way I found is to use helper methods for ASP's Rasor renderer.
Is there a good known way to render React.js DOM as string with pure C#?
Upvotes: 3
Views: 2850
Reputation: 325
Daniel Lo Nigro was kind to provide details how to do it with React.NET
var environment = React.AssemblyRegistration.Container.Resolve<IReactEnvironment>();
var component = environment.CreateComponent("HelloWorld", new { name = "Daniel" });
var html = component.RenderHtml();
More details https://github.com/reactjs/React.NET/issues/178
Upvotes: 3