This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-08
Channels
- # announcements (7)
- # babashka (44)
- # beginners (162)
- # cider (22)
- # clara (11)
- # clj-kondo (14)
- # cljsrn (8)
- # clojure (91)
- # clojure-dev (24)
- # clojure-europe (6)
- # clojure-france (4)
- # clojure-italy (11)
- # clojure-nl (4)
- # clojure-spec (11)
- # clojure-uk (14)
- # clojurescript (92)
- # community-development (1)
- # core-logic (1)
- # cryogen (1)
- # cursive (6)
- # data-science (3)
- # datahike (3)
- # datomic (32)
- # degree9 (3)
- # dirac (3)
- # emacs (9)
- # eql (1)
- # events (1)
- # find-my-lib (1)
- # fulcro (67)
- # graphql (13)
- # helix (9)
- # jobs (1)
- # jobs-discuss (92)
- # leiningen (31)
- # malli (8)
- # meander (3)
- # news-and-articles (1)
- # off-topic (46)
- # pathom (2)
- # practicalli (1)
- # re-frame (52)
- # reitit (12)
- # shadow-cljs (40)
- # spacemacs (10)
- # sql (4)
- # xtdb (8)
This expression:
(.val (js/jQuery (str "delivery" (:num-delivery-addresses db))) (:description suggestion))
in my fx handler gives the following error:
Uncaught Error: [object Object] is not ISeqable
at Object.cljs$core$seq [as seq] (core.cljs:1226)
at re_frame$fx$do_fx_after (fx.cljc:74)
at Object.re_frame$interceptor$invoke_interceptor_fn [as invoke_interceptor_fn] (interceptor.cljc:71)
at Object.re_frame$interceptor$invoke_interceptors [as invoke_interceptors] (interceptor.cljc:109)
at Object.re_frame$interceptor$execute [as execute] (interceptor.cljc:204)
at Object.re_frame$events$handle [as handle] (events.cljc:65)
at Object.eval [as re_frame$router$IEventQueue$_process_1st_event_in_queue$arity$1] (router.cljc:179)
at Object.eval [as re_frame$router$IEventQueue$_run_queue$arity$1] (router.cljc:198)
at eval (router.cljc:146)
at Object.eval [as re_frame$router$IEventQueue$_fsm_trigger$arity$3] (router.cljc:169)
cljs$core$seq @ core.cljs:1226
re_frame$fx$do_fx_after @ fx.cljc:74
re_frame$interceptor$invoke_interceptor_fn @ interceptor.cljc:71
re_frame$interceptor$invoke_interceptors @ interceptor.cljc:109
re_frame$interceptor$execute @ interceptor.cljc:204
re_frame$events$handle @ events.cljc:65
eval @ router.cljc:179
eval @ router.cljc:198
eval @ router.cljc:146
eval @ router.cljc:169
G__67540 @ router.cljc:187
channel.port1.onmessage @ nexttick.js:218
Why would that be?(re-frame.core/reg-event-fx :show-next-delivery-panel! (clojure.core/fn [{:keys [db]} [___68401__auto__ suggestion]] (prn "suggestion is " suggestion) (prn "description is " (:description suggestion)) (prn "db is" db) (prn "num delivery addresses " (:num-delivery-addresses db)) (prn "id is " (str "delivery" (:num-delivery-addresses db))) (prn (js/jQuery (str "delivery" (:num-delivery-addresses db)))) (.val (js/jQuery (str "delivery" (:num-delivery-addresses db))) (:description suggestion))))
That's better:
(reg-event-fx :show-next-delivery-panel!
(fn [{:keys [db]} [___68401__auto__ suggestion]]
(prn "suggestion is " suggestion)
(prn "description is " (:description suggestion))
(prn "db is" db)
(prn "num delivery addresses " (:num-delivery-addresses db))
(prn "id is " (str "delivery" (:num-delivery-addresses db)))
(prn (js/jQuery (str "delivery" (:num-delivery-addresses db))))
(.val (js/jQuery (str "delivery" (:num-delivery-addresses db))) (:description suggestion))))
reg-event-fx must return effects
(reg-event-fx ;; -fx registration, not -db registration
:my-event
(fn [cofx [_ a]] ;; 1st argument is coeffects, instead of db
{:db (assoc (:db cofx) :flag a)
:dispatch [:do-something-else 3]}))
you are returning whatever (.val js/jQuery ...)
returnsi just went to the documentation and it was clear your mistake. re-frame's docs are very good
Real world react native application built with clojurescript and re-frame https://github.com/flexsurfer/conduitrn
its a port of web application, so you can see a difference between web and RN re-frame applications
@andre Good time for me to add this to re-frame resources?
Will push a bit later today
I'm looking for a re-natal-like template that works with shadow-cljs rather than figwheel
@pshar10 you don't need re-natal at all. just use shadow-cljs as normal. there are some example projects that do.
well the react-native docs should have all of that. you just do whatever that tells you. shadow-cljs just produces one output file that is included normally. everything else is up to react-native
tooling.
It gives you a template for RN and also some helpers for using re frame with RN (navigation is tricky)
It is straightforward to setup as you asked.
My guess is you need to experiment a bit to get the ideas and the constraints of RN and CLJS and once you have some experience you can create your own template or judge the quality of each.
CLJS idioms are usually incompatible with many examples of RN in my opinion. This is mostly because example are done in JS/TS with OOP model.