3

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#?

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.