This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-29
Channels
- # aleph (2)
- # architecture (1)
- # beginners (5)
- # boot (7)
- # cider (24)
- # clara (28)
- # cljs-dev (7)
- # cljsjs (3)
- # cljsrn (24)
- # clojure (145)
- # clojure-italy (2)
- # clojure-nl (7)
- # clojure-uk (54)
- # clojurescript (159)
- # cursive (49)
- # data-science (8)
- # datomic (23)
- # editors (10)
- # emacs (2)
- # fulcro (123)
- # graphql (12)
- # hoplon (2)
- # java (23)
- # jobs (1)
- # jobs-discuss (2)
- # leiningen (17)
- # mount (5)
- # nrepl (5)
- # off-topic (20)
- # om (2)
- # onyx (25)
- # parinfer (2)
- # pedestal (1)
- # re-frame (8)
- # reagent (7)
- # ring-swagger (1)
- # shadow-cljs (24)
- # spacemacs (7)
- # specter (6)
- # tools-deps (7)
- # vim (2)
for anyone wanting to use React contexts with Reagent, I wrote a little wrapper this afternoon: https://gist.github.com/mhuebert/d400701f7eddbc4fffa811c70178a8c1 example usage:
(:require [example.reagent-context :as c])
;; in a component somewhere
[c/provide {:app-theme {:color "blue"}}
[c/consume :app-theme
(fn [theme]
[:div
{:style {:color (:color theme)}} "Colorful Text"])]]
contexts can either be keywords or, if you’re interop’ing with libs, an existing React context instance. Reactivity (with ratoms/reactions) should ‘just work’ even inside the consume
callback. (Feedback welcome.)👍 4
@mhuebert looks very useful
I wrote and released a small library that does similar https://github.com/Lokeh/reagent-context
👍 8
@lilactown 👍:skin-tone-2: I have added a prior art link to your thing in my gist. For reactivity, I used reagent's vector form inside the component to call the function.
replied to a thread:how does reactivity work within the callback passed to consume?
@lilactown 👍:skin-tone-2: I have added a prior art link to your thing in my gist. For reactivity, I used reagent's vector form inside the component to call the function.