This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-17
Channels
- # announcements (17)
- # aws (2)
- # babashka (21)
- # beginners (67)
- # calva (19)
- # cider (29)
- # clara (3)
- # clj-kondo (6)
- # cljsrn (10)
- # clojure (140)
- # clojure-europe (164)
- # clojure-nl (3)
- # clojure-uk (8)
- # clojurescript (62)
- # conjure (7)
- # core-async (24)
- # cursive (21)
- # datomic (5)
- # docker (40)
- # emacs (14)
- # fulcro (25)
- # gratitude (1)
- # honeysql (6)
- # introduce-yourself (1)
- # jobs (1)
- # jobs-discuss (32)
- # juxt (7)
- # lsp (13)
- # minecraft (2)
- # off-topic (49)
- # pathom (24)
- # practicalli (8)
- # re-frame (18)
- # react (23)
- # remote-jobs (6)
- # reveal (2)
- # shadow-cljs (75)
- # tools-deps (7)
If I have an effect that wants to assoc-in to a DB in two spots, whats the easiest way? It complaiend about me having two :db keys in the effect map
{:db (-> db
(assoc-in [:spot-1] thing)
(assoc-in [:spot-2] another-thing))}
Yeah ^ quick example
Ok, I have some JS React I need to try and leverage from re-frame that's a bit beyond my current interop understanding:
<Menu model={items} popup ref={menu} />
<Button label="Show" icon="pi pi-bars" onClick={(event) => menu.current.toggle(event)}/>
What I have so far:
(defn right-nav []
(let [
menu-items [{:label "Logout" :icon "pi pi-fw pi-times-circle"}
{:label "Help" :icon "pi pi-fw pi-question"}]]
[:<>
[:> Menu {:model (clj->js menu-items) :popup true}]
[:> Button {:on-click (menu.current.toggle %)} "Menu"]]))
Go through Reagent examples in its repo - there are bound to be code samples of very similar things.
The interop here is just getting a field from a JS object and then calling a function that belongs to the resulting value. Pretty much the very first two things in the JS-CLJS interop guides.
You probably meant "with" and not "vs". :) Re-frame is about the state of your application. Everything to do what your consider your app's state and also usually with all the interactions with the outside world that happen to be relevant to that state. Anything else should probably be done outside of re-frame, so probably at the Reagent level.