Fork me on GitHub
#reagent
<
2022-04-10
>
mauricio.szabo23:04:23

Hi, is there a way to make an normal atom (or, in my case, an IDeref thing) behave like a r/atom? Specifically, I want to try an experiment with Javelin and reagent

snoe01:04:02

I believe you can use r/cursor but not sure if that's a blessed way to use it. There's also make-reaction and r/wrap.

mauricio.szabo03:04:26

I don't think these will work - reading the docs, they all expect you to deref a r/atom at some moment...

mauricio.szabo23:04:24

Also, I'm having a stack overflow error when I try to render a [:div "lots" "of" "elements" "here"...], is that expected?

snoe03:04:45

It's definitely possible to render many thousands of elements in a div. sounds like something else is going on, but try to repro in isolation.

mauricio.szabo03:04:32

Thousands of elements work. Thousands of strings is where I'm having trouble. I'll send an example tomorrow :)

mauricio.szabo19:04:47

Yeah, this fails:

(reagent.dom/render (vec (cons :div (map str (range 80000))))
                      (js/document.querySelector "#result"))

mauricio.szabo19:04:18

I could not make it work with thousands of hiccup elements instead of a single string, nor by manually creating a react component...