This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-06
Channels
- # aws-lambda (6)
- # babashka (1)
- # beginners (204)
- # calva (10)
- # chlorine-clover (17)
- # cider (57)
- # cljs-dev (3)
- # cljsrn (3)
- # clojure (148)
- # clojure-bangladesh (1)
- # clojure-berlin (3)
- # clojure-europe (30)
- # clojure-france (1)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (4)
- # clojure-uk (14)
- # clojurescript (15)
- # code-reviews (8)
- # conjure (27)
- # data-science (9)
- # datomic (38)
- # duct (6)
- # figwheel-main (11)
- # fulcro (78)
- # helix (11)
- # jobs (1)
- # malli (18)
- # meander (22)
- # mount (4)
- # nrepl (3)
- # off-topic (93)
- # pathom (2)
- # pedestal (4)
- # re-frame (5)
- # reagent (6)
- # reitit (1)
- # ring-swagger (1)
- # sci (1)
- # shadow-cljs (19)
- # spacemacs (1)
- # sql (1)
- # tools-deps (76)
- # unrepl (1)
- # vim (5)
- # xtdb (8)
has anyone used re-frame & async storage with rn? i’m having issues writing a coeffect that can read from storage and it’s proving to be tricky in cljs
I use an effect with callback event. Pseudo implementation:
(defn get-items
[db-keys cb]
(-> async-storage
(.multiGet (clj->js (mapv keyword->string db-keys)))
(.then process-data)
(.then cb)
(.catch (fn [error]
(cb nil)
(log/error "[async-storage]" error)))))
(reg-fx
:data-store/get
(fn [{:keys [keys cb]}]
(get-items keys #(dispatch (conj cb %)))))
And use like that:
:data-store/get {:keys [:user/token]
:cb [::auth/init]}