This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-11
Channels
- # announcements (2)
- # babashka (27)
- # beginners (99)
- # biff (16)
- # calva (15)
- # clj-kondo (6)
- # clj-on-windows (38)
- # clojure (54)
- # clojure-austin (1)
- # clojure-europe (30)
- # clojure-france (4)
- # clojure-nl (1)
- # clojure-norway (43)
- # clojure-spec (10)
- # conjure (28)
- # core-async (4)
- # cursive (7)
- # figwheel-main (1)
- # graphql (9)
- # gratitude (3)
- # honeysql (9)
- # introduce-yourself (1)
- # jobs (1)
- # joyride (128)
- # lambdaisland (2)
- # malli (8)
- # membrane (12)
- # nbb (5)
- # off-topic (1)
- # polylith (11)
- # re-frame (9)
- # reitit (1)
- # remote-jobs (5)
- # sci (15)
- # shadow-cljs (50)
- # tools-deps (2)
- # xtdb (12)
Hello! On the topic of counters: I have a list of items and when the user adds/removes a bunch of items, I want a counter to count up or down with an animation. https://css-tricks.com/animating-number-counters/ but since I need the counter to change at runtime based on user input and to a value that is only determined at runtime, I think, I can only solve this using CLJS.
Now, the question. Am I going to run into rendering issues with reagent/re-frame, if I do this in a side effect using requestWindowAnimationFrame
?
To be honest, I'm not even sure I can do this with requestWindowAnimationFrame
and I'd also like to know if anyone has suggestions on how to address this. Maybe I need to prototype a little first.
Well, at first I was thinking about doing this in a side-effect. More precisely, I would write a function that manipulates the DOM, i,e, changes the number value, inside requestWindowAnimationFrame
and execute that function in an effect handler. However, that feels weird to me because I would mess around with the DOM outside of react/reagent, which works and is in this case just a minor issue but it also feels like having state outside of re-frame. There is some risk here. I'll just try and see if it works.
> feels like having state outside of re-frame Would you consider this a state though? Something being displayed on screen doesn't necessarily mean that it's a part of the state. It makes even more sense in my mind when I think of a client with a 60 Hz monitor and a client with a 200 Hz one. With the current animation frame being considered a part of the app's state, such clients could never have the same app, except for the 0th frame.
Interesting point. Still feels weird to trigger this change outside of reagent re-frame but I think it's exactly how this is meant to be used.