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)
Hello! How can i work with r/atom db in re-frame without this: #<Atom: []> ?
That's whole chain:
(def records (r/atom []))
---
(rf/reg-sub
::get-data
(fn [_]
db/records))
---
(def recs (rf/subscribe [::subs/records]))
[:p "" @recs]
::subs/get-data*
So it comes like #<Atom:[ *data* ]>
Derefing a sub returns the value that the sub function returns. Your sub function returns a ratom, so derefing that sub returns that very same ratom.
If you want to get the value within the ratom, just deref it inside the sub function.
But you shouldn't be using external ratoms in your subs.
You either should just directly use ratoms, without any subs, or put the relevant value in the re-frame's app-db
via some event.
And if i deref if subs it returns me #<Reaction*some number*: [data]>
in subs*
If you removed the @
in front of recs
then add it back.
If you didn't, them I can't really add anything to my previous message. Just don't use regular ratoms in subs.
Hello, i don’t know how to redirect to different SPA, after login. Anyone have an example? Thanks.
Maybe something like
(aset (.-location js/window) "href" url)
you can put it in reg-fx
Depends on what "different SPA" means exactly.
If you mean the same page within the same application, then ideally you would use some routing library like e.g. bidi or reitit that integrate well with HTML5 history. They have all the necessary facilities to redirect from one page to another.
If you mean an entirely different app, then the answer above is the correct one. Except that you should not use aset
. It should be
(.assign js/location url)
I think.