reactjs / React.NET

.NET library for JSX compilation and server-side rendering of React components
https://reactjs.net/
MIT License
2.3k stars 937 forks source link

Is it possible to define the react components within the render() method server side in asp.net core ? #1259

Open giannik opened 3 years ago

giannik commented 3 years ago

Hello. I am using a third party react client library for elastisearch (https://opensource.appbase.io/reactivesearch/) where i define the components inside the render() method of a .tsx file.

Is it possible with react.net to dynamically define the html and react components from the server side in asp.net core and then consume from the react component. See I have a design guy who wants to define the rendered template from server side code in asp.net core razor and pass it into a custom renderer dynamically.

So I am imagining the solution something like the following . I might have a hidden or nested div inside the main entry point from my razor template in asp,net core (which contains the html and react components ) i wish to pass to the render() method and that will be defined server side ,

Is such a senario possible with react.net ?

image

KoriSeng commented 3 years ago

I think the same code should fit your use case, just pass in that url as part of the props