This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-20
Channels
- # announcements (2)
- # babashka (1)
- # bangalore-clj (1)
- # beginners (5)
- # cider (16)
- # clojure (125)
- # clojure-spec (3)
- # clojure-uk (5)
- # clojurescript (27)
- # cursive (46)
- # data-science (3)
- # dirac (2)
- # emacs (11)
- # fulcro (2)
- # graphql (4)
- # luminus (2)
- # nrepl (1)
- # pathom (15)
- # re-frame (1)
- # reagent (52)
- # shadow-cljs (149)
- # sql (11)
- # tools-deps (11)
- # xtdb (14)
@benzap I have used binding with async code in the past where, on each async boundary, I lexically bind the current value of the dynamic var outside, then inside re-`binding` the dynamic var
example:
(def ^:dynamic *foo*)
(defn use-foo-broken []
(prn *foo*)
(js/setTimout use-foo-broken 100))
(binding [*foo* "bar"]
(use-foo-broken))
;; prints: "bar" nil nil nil ...
(defn use-foo-works []
(prn *foo*)
(let [foo *foo*] ;; lexically bind the current value of *foo*
(js/setTimeout
(fn []
(binding [*foo* foo]
(use-foo-works))) 1000)))
(binding [*foo* "bar"]
(use-foo-works))
;; prints: "bar" "bar" "bar" "bar" ...
it’s pretty gross for userland code, but I’ve used it with success for library-level code to build powerful abstractions in CLJS
but something like that could be used to provide binding conveyance at a syntax level
@lilactown this seems like a pretty awesome workaround, thanks! I wish I knew about this before I changed a bunch of code a wrote a while back, haha
What is you favourite way to record GIF images from your website? Like 1) click here, scroll mouse, write something here, wait x sec. But not for testing, but for GIF recording from your website. What tools do you use for your SPA in cljs?
Hey guys, how I call #'component'
with parameters? I need to pass around reagent componenents, and it works, but can't do it on components with parameters. Where component is (defn component [some-props] [:div some-props])
@paul931224 I don’t know what you mean by call
. how are you trying to call it?
this is what I mean, I tried it with (apply components props)
, but it didn't work, I don't really understand this part yet 😄
@lilactown I guess my question is how would you make a wrapper component which counts how many times did its child re-render. I may have approached it in the wrong way
well somehow it must be possible, I watched https://youtu.be/g01dGsKbXOk?t=664 and I very much like the idea of a render visualizer, that's my first approach to it.
@dpsutton this doesn't work either 😕
@paul931224 that component he’s talking about is used as a mixin
(which are deprecated in React but you can do some similar things with class inheritance or a helper function)
it’s not tracking how often its child re-renders, but how often the component the visualizer is used in re-renders
can anyone here help me with this? https://gist.github.com/reallymemorable/28347e04b714ac9dd37aa32c859f1000
Hi! I don’t have time to go in depth on this, and giving a proper answer would require some more context. But here’s a reagent implementation of modals, might help: https://github.com/Frozenlock/reagent-modals
this one might be simpler to understand https://github.com/benhowell/re-frame-modal
Basically, I want to do something along the lines of:
[:div {:class "bp3-button", :on-click #(js/confirm "App settings go here")}
[bp/icon {:icon "cog", :style {:color "#555555"}, :on-click #(dispatch [:div {:show? true, :child [myDialogPopup]}}]
]
Not sure if that makes it any clearer
I want to replace the standard Javascript confirm
that is currently prompted --- :on-click #(js/confirm "App settings go here")
--- to something that displays the custom blueprint popup I have defined in the gist.
im new to cljs and lost