Fork me on GitHub
#reagent
<
2017-08-09
>
pupeno14:08:21

Is there a way to convert a reagent component [:like "this"] to a node I can pass to appendChild?

juhoteperi15:08:40

@pupeno Not cleanly, but you could use reagent.dom.server/render-to-string and call document.createElement with that

juhoteperi15:08:25

e.g https://github.com/teropa/hiccups is probably much better fit for this as you don't really need React for anything in this case

pupeno15:08:01

@juhoteperi I need react and I wouldn't use hiccups as it's prone to XSS.

pupeno15:08:38

Ah... that might be a different Hiccup.

juhoteperi15:08:53

No React features will work if you render React component somehow and put that to DOM using appendChild

pupeno15:08:27

I'm creating a custom class, but I get your point.

juhoteperi15:08:32

Maybe you want to use reagent/as-element instead? That will return native React element you can pass to other components