This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-28
Channels
- # anglican (2)
- # announcements (2)
- # babashka (41)
- # babashka-circleci-builds (1)
- # beginners (45)
- # brompton (2)
- # calva (13)
- # cider (13)
- # clj-kondo (14)
- # cljsrn (6)
- # clojure (60)
- # clojure-europe (4)
- # clojure-nl (3)
- # clojurescript (1)
- # code-reviews (3)
- # conjure (2)
- # cryogen (5)
- # datomic (22)
- # fulcro (13)
- # graalvm (19)
- # introduce-yourself (1)
- # kaocha (2)
- # leiningen (2)
- # lsp (1)
- # malli (4)
- # meander (1)
- # music (1)
- # news-and-articles (2)
- # off-topic (17)
- # polylith (6)
- # practicalli (2)
- # react (15)
- # reactive (1)
- # reagent (8)
- # reitit (2)
- # releases (1)
- # rum (10)
- # shadow-cljs (6)
- # spacemacs (4)
- # sql (2)
- # tools-deps (4)
- # xtdb (21)
Say I want to pass a key to a component and create a cursor out of it, how do I prevent making a new cursor every time the component is rerendered?
Just kinda shooting in the dark here, but maybe store it in an atom that lives outside the component?
Hm. So in Reagent there are form-2 components where there is an outer function and an inner function that's actually what gets rendered.
I'm thinking the Rum equivalent might be to make a mixin? Like, you add the cursor to the state on will-mount and remove it on did-unmount. Something like that?
I'm not really sure that would be an improvement. Say I have code like this
(for [key something
:let [cursor (mycursor state key)]
[my-cool-component cursor key])
When would that make a new cursor? I guess I'll have to experiment.As I understand it, React does something smart with the key of loop items so it doesn't rerender the whole loop, but I'm not sure at what level that happens.
Seems better to me. If the for
runs only once then cursors are only created once, even when the components are re-rendered.
Hm I kinda assumed everything in Cljs works with core.async but that was a bit of a miscalculation for the quite insane hacks I'm trying to do.
Have you seen this ?