This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-02
Channels
- # adventofcode (76)
- # announcements (1)
- # asami (1)
- # babashka (31)
- # beginners (302)
- # calva (3)
- # cider (1)
- # clj-kondo (1)
- # cljdoc (1)
- # cljfx (63)
- # cljsjs (2)
- # clojure (36)
- # clojure-europe (29)
- # clojure-gamedev (2)
- # clojure-nl (5)
- # clojure-sanfrancisco (2)
- # clojure-spec (2)
- # clojure-uk (71)
- # clojurescript (19)
- # conjure (21)
- # core-async (10)
- # core-matrix (1)
- # cryogen (4)
- # cursive (12)
- # datomic (22)
- # emacs (4)
- # events (1)
- # figwheel-main (7)
- # fulcro (9)
- # graalvm (1)
- # jobs (1)
- # kaocha (17)
- # lambdaisland (1)
- # meander (7)
- # mount (2)
- # nrepl (12)
- # off-topic (35)
- # re-frame (15)
- # reagent (17)
- # remote-jobs (1)
- # reveal (41)
- # shadow-cljs (13)
- # spacemacs (2)
- # tools-deps (24)
Yes. Reagent has its own scheduler for updates from reagent atoms. By default, updates are asynchronous. Flush synchronously updates the component
In reagent is there a way to create a context for certain atoms/data sources to be easily accessed without passing them through components. For example I'm using datascript/posh to maintain two states (one for the app and one for the ui specific states) but have to pass them through whenever I need them, sometimes passing down to components that don't use them. In JS react I've used the usecontext, but wondering if there's something similar to that in reagent or a similar strategy equivalent
seems a lot of solutions in this thread https://github.com/reagent-project/reagent/issues/330
I am sure this was already asked at a point.. anyways is there a safe way to trigger a state update when a component re-renders?
Because I’d end up swapping the atom in the rendered function itself (infinite loop can’t happen in my case). I don’t think it’s a nice thing to do
My problem is I have some local state... My rendering function updates and I was trying to figure out a clean way to update the local state
The effect hook would work perfectly fine for this, but that means rewriting so much code and can’t do that
Triggering a state update when a component re-renders can create an infinite loop regardless of how you update the state.
IMO it is absolutely fine to make non-loop-inducing updates from within the render function if you indeed need to update the state on every render.
Alternatively, you can use the relevant lifecycle method: https://reactjs.org/docs/react-component.html#componentdidupdate
Oh how stupid this is perfect! I was looking at the should update but this is exactly what I needed instead :man-facepalming::skin-tone-3: thanks 🙏:skin-tone-2:
Hi. I’m trying to document one of my projects with a bit more style. It’s based on reagent, and I quite liked the reagent project page, where some components are showed and explained along with the source code. The source code is handled by the syntax.clj(s) files in the reagentdemo subproject along with demo-component in common.cljs. Is it OK to copy these and give acknowledgement?
I'm not affiliated with reagent, but its sources' license is MIT, so I'm pretty certain you can do that. https://github.com/reagent-project/reagent/blob/master/LICENSE