helix

https://github.com/Lokeh/helix
ordnungswidrig 2021-02-25T08:09:16.006200Z

@esp1 I think useRef is your friend.

(let [containerRef (useRef)]
  (d/div {:id "mycontainer" :ref containerRef}
    ($ ThatMapBoxComponent {:whatever containerRef}))) 

ordnungswidrig 2021-02-25T08:09:42.006900Z

But you could just use a fixed id for the container if the Mapbox components is happy with it.

1👍1☝️
lilactown 2021-02-25T17:33:55.008800Z

In current version of helix its helix.hooks/use-ref 🙂

lilactown 2021-02-25T17:35:02.010500Z

You can pass it to DOM elements like above, and also treat the ref like an atom

wilkerlucio 2021-02-25T17:35:31.011Z

also, value of :ref can be a function, that receives the DOM node at the first argument once its mounted

2☝️
esp1 2021-02-25T18:11:57.011300Z

oh nice! i didn't know that

oconn 2021-02-25T20:23:13.011500Z

What does the future version look like? 😂

lilactown 2021-02-25T20:38:34.011700Z

probably the same 😛 the example above used useRef and I wasn't sure if they were using hx or something

lilactown 2021-02-25T20:38:56.011900Z

though I may in a future version move the hooks definitions to helix.core: https://lilac.town/writing/towards-helix-1-0/

oconn 2021-02-25T23:10:51.014700Z

That would be nice, even if they just alias the hooks namespace at first. Feel like most of the time I end up importing both.