Fork me on GitHub
#reagent
<
2020-10-25
>
wombawomba14:10:28

So I’m trying to render a react-based JS lib in my Reagent app. Unfortunately said JS lib expects to be passed a DOM element to which it can render itself. How can I build a Reagent component that handles this?

simongray15:10:58

You can use the :ref attribute to capture a reference to the DOM element once the component has been added to the DOM. Then you can either do something with it immediately or store it in a r/atom. https://github.com/reagent-project/reagent/blob/master/doc/FAQ/UsingRefs.md

wombawomba15:10:24

Cool, thanks 🙂

simongray15:10:50

No problem. 🙂 :ref is really useful.