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

Can I help? #1340

Closed LorenDorez closed 1 year ago

LorenDorez commented 1 year ago

I've been a long time user of ReactJS.Net for both personal projects and at my normal day job. I know Dustin posted his time is limited to keep this project growing and that the original goals have somewhat been achieved.

However, there are many who are still looking to use this project in newer versions of react. While we would not be able to part-take of all the new features in React v18 like streaming, there is still a desire to get there even just better performance and things like code-splitting using React.lazy() vs Loadables.

I have successfully implemented code-splitting with the Loadables library and MaterialUI (MUI w/emotion) support in an internal project that uses ReactJS.Net that I would be willing to port over here for more mainstream support for others looking for the same.

I have also got a good working POC of NodeReact.Net with fixes for MUI/Emotion (css-in-js) support.

I am be willing to help pick up the load for continuing the project and would look to merge the concepts from NodeReact.Net into this repo to have a 1-stop shop for continuing to support react in a .Net environment.

Please let me know if this is something that you would consider

Daniel15 commented 1 year ago

Sure, that sounds good! Feel free to submit pull requests 😃

LorenDorez commented 1 year ago

Do since we dont have discussions enabled here i figure ill just build on it here or we can spin this off to a new issue.

  1. I had to do a lot of upgrade across the board since a lot of this project still targets .NET 4.5 which finished support in April 2022. To make this transition a bit easier im upgrading it to 4.7.2 as a soft upgrade before doing 4.8.x in a future update, anyone see any issues here?

  2. In trying to update the React.core project to handle v18 ive come to find that the JSE engines dont have support for TextEncoder/Decoder like modern browsers do. This is a pain point because in React v18 they changed the method .renderToNodeStream() from simply throwing an error on execution/usage to adding support using a NodeReadableStream which imports and uses TextEncoder/Decoder. We could add a polyfill inside React.Core but im on the fence is this is the best approach or have the consuming app add whatever polyfill they deem best. Also going forward using .renderToString() isnt going to be the best way to handle things as it doesnt support the new Suspense/Data fetching and will just render the fallback placeholders.

So my thought here would it be best to bring the main branch up to latest version of v17.x and then work on a bigger breaking change to merger the work @DaniilSokolyuk has done on the NodeReact project into this one since its more widely used.

Daniel15 commented 1 year ago

dont have discussions enabled here

@LorenDorez I just enabled discussions :)

ive come to find that the JSE engines dont have support for TextEncoder/Decoder like modern browsers do.

Is that the case even for the V8 engine? Is TextEncoder a browser API, a DOM API or a JavaScript API?

It looks like Node.js has an embedding API: https://nodejs.org/api/embedding.html. It's possible we can interop with this using C++/CLI... As far as I know, C++/CLI now works with .NET Core too. We'd have a C++/CLI library that does the interop, and then interact with that library from the C# library. I wonder if anyone has already created a C# wrapper for this API.

So my thought here would it be best to bring the main branch up to latest version of v17.x and then work on a bigger breaking change to merger the work @DaniilSokolyuk has done on the NodeReact project into this one since its more widely used.

Yes, I'd definitely prefer a series of small changes over one huge one.

LorenDorez commented 1 year ago

IM going to move this over to discussion for now