react

Aron Gabor 2023-10-03T08:15:35.754279Z

what is a clojurescript react wrapper that can work well with react 18 including https://react.dev/reference/react-dom/server/renderToPipeableStream

Aron 2024-01-07T15:16:36.471129Z

I think we were talking at cross purposes, it's totally on me, not making myself clear. The idea would be so that I don't have to manually work out all the kinks related to renderToPipeableStream myself. for example, after 3 months now, I returned to this, and while the initial page load works just fine, I can hydrate, etc. Hot reload (with shadow-cljs) doesn't. I don't yet know what the problem is, but probably 3 more months until I have time again...

Aron 2024-01-07T17:05:11.230849Z

like, i have this after page load

(when nil? @container (reset! root (createRoot @container)))
and still I get errors from react > Warning: You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.

Aron 2024-01-07T17:05:23.435869Z

🀯

Aron 2024-01-07T17:06:24.294659Z

at page load, so no hot-reload yet

Aron 2024-01-07T17:06:41.890429Z

it just makes no sense why this is happening

Roman Liutikov 2024-01-07T17:13:57.477309Z

Well, the code is wrong. Also the container should be defonce

Roman Liutikov 2024-01-07T17:14:43.892229Z

I still don’t see how this could help with your issues.

Roman Liutikov 2024-01-07T17:15:36.435329Z

Sorry, root creation should be defonced

Aron 2024-01-07T17:20:14.054459Z

what do you mean how this could help πŸ™‚

Aron 2024-01-07T17:20:31.187699Z

and i realized that i need defonce, but that alone is not fixing this error

Aron 2024-01-07T17:20:42.957509Z

thanks either way. I appreciate it

Roman Liutikov 2023-10-03T08:23:25.929429Z

UIx and Helix are the most popular ones

Aron Gabor 2023-10-03T08:53:22.911739Z

I know, but sadly it's been a long time when I could find any correlation between popularity and corner cases being supported πŸ™‚ I was hoping maybe someone can speak from experience. I managed to set up reagent but these inconsistencies make all the work dubious now.

Roman Liutikov 2023-10-03T08:54:25.741949Z

both are thin wrappers around React, including support for v18, that's the only requirement needed to be able to use renderToPipeableStream

Roman Liutikov 2023-10-03T08:55:10.965579Z

even if none of them wrap and expose renderToPipeableStream, it's still possible to use the function by requiring React directly and calling react/renderToPipeableStream

Aron Gabor 2023-10-03T08:59:59.156899Z

of course, but then I am creating code I need to maintain myself, and it will be between two external dependencies so that's a bit too much risk for some applications that I just want to write and forget

Roman Liutikov 2023-10-03T09:01:20.097849Z

well, it's literally a single function call that doesn't require any gluing code, I don't see how it can be risky

Roman Liutikov 2023-10-03T09:02:00.247649Z

if renderToPipeableStream gets a breaking change in the future in React, the same will happen in the wrapping libraries

lilactown 2023-10-03T15:22:10.914369Z

helix doesn't have any code that wraps react-dom/client or react-dom/server, and may not ever. it's expected that helix helps creating components and elements, and how you render them (dom server, dom client, react native, etc.) is your code

lilactown 2023-10-03T15:23:31.682769Z

Roman's totally right that calling renderToPipeableStream is as low amount of coupling as you can get.