How can I access a the underlying dom node from within a component? I'm trying to wrap a vanilla js library in a component nevermind, I got it!
assuming this is what you found but for the benefit of others 🙂
Thanks! And, also for future users, the general helix pattern is this:
(defnc my-lib-component [{:keys [opts] :as props}]
(let [ref (hooks/use-ref nil)
d (d/div {:ref ref})]
(hooks/use-effect []
(MyLibConstructor. opts @ref))
d))
Where my lib-constructor is a vanilla js lib that takes a dom node in the constructor@jjttjj You can do (hooks/use-effect :once ...) instead too which reads a little nicer.