Fork me on GitHub
#fulcro
<
2023-04-24
>
Quentin Le Guennec09:04:19

I need to access fulcro’s reactRoot , is there any current api for that? I need it for fulcro support in the portfolio lib.

Quentin Le Guennec12:04:56

I added it to the with-react18 function => (assoc ::reactRoot reactRoot) let me know if I can open a PR for that or not. Maybe I’m missing something obvious.

tony.kay16:04:39

I’ll have a look. There is already the concept of react root, but I wasn’t sure if the new version was compatible with the old.

Quentin Le Guennec08:04:37

Sure Tony, thanks. I opened a PR, let me know if you think there’s some other way around that makes more sense.

Barna Mumtyan14:04:16

Hey guys, how can I do this with fulcros built in templating instead of hiccup In the fulcro-rad-demo there’s this line adding the csrf token [:script (str "var fulcro_network_csrf_token = '" csrf-token "';")]] I want to do that with fulcros built in templating with [com.fulcrologic.fulcro.dom-server :as dom] `(dom/script (str “var fulcro_network_csrf_token = ‘” (get props :csrf-token) “’;“)))` but the quotes get escaped and I get this in the browser var fulcro_network_csrf_token = &#x27;2rqljB6myiy477nNoXk6QpqxPG0CjFlz1tNZXDFA2le/a3seAP+AFnBBkwlC9idS0yIAzeUPNJ2bmb88&#x27;; How can I put javascript in the dom/script tag?

Quentin Le Guennec08:04:02

did you try to escape the quotes like this: \" ?

Barna Mumtyan14:04:42

yes, in that case it prints &quot in js

Quentin Le Guennec11:04:58

you can also use ' single quotes, they work the same as double quotes in javascript

tony.kay16:04:18

The server-side rendering support is not meant for general use as a server HTML generation library. It is meant to act as a way to get a DOM that react can accept. React, in general, does NOT want you to embed js this way (see dangerouslySetInnerHTML). This is why I use a server-dedicated library (hiccup) to generate these.

tony.kay16:04:23

Technically, I think you should be able to use the dangersoulySetInnerHTML, but I don’t think I even support it from the server-side lib. So, basically, this is something I do not ever plan to support, but might work by accident.

tony.kay16:04:50

The output you are getting is exactly what the library should emit, but of course isn’t what you desire.