This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-06
Channels
- # aleph (2)
- # arachne (4)
- # aws (3)
- # beginners (196)
- # cider (131)
- # cljs-dev (208)
- # clojure (193)
- # clojure-boston (1)
- # clojure-dev (26)
- # clojure-greece (4)
- # clojure-italy (26)
- # clojure-losangeles (1)
- # clojure-russia (11)
- # clojure-spec (40)
- # clojure-uk (78)
- # clojurescript (168)
- # cursive (25)
- # datascript (1)
- # datomic (31)
- # docker (8)
- # docs (1)
- # emacs (20)
- # fulcro (62)
- # hoplon (3)
- # jobs (1)
- # leiningen (3)
- # luminus (1)
- # nrepl (25)
- # off-topic (10)
- # other-languages (3)
- # parinfer (11)
- # planck (37)
- # portkey (54)
- # protorepl (11)
- # re-frame (2)
- # reagent (19)
- # remote-jobs (1)
- # ring (2)
- # rum (8)
- # shadow-cljs (23)
- # spacemacs (4)
- # uncomplicate (6)
- # unrepl (77)
- # vim (56)
- # yada (2)
How to use https://github.com/PrismJS/prism with reagent? prism looks great.
@wqhhust you mean how would you use the prism library as a component in a reagent webpage?
<template slot='action_plan' slot-scope='data'>
<prism language="sql" :plugins="['toolbar','copy-to-clipboard']" :code="data.value">
</prism>
</template>
have you taken a look at https://github.com/reagent-project/reagent/blob/master/docs/InteropWithReact.md
i actually do not know vue, but i am assuming that is some kind of jsx like syntax?
do you guys generally store something in a top most atom, then have the children of the parent handle mutations?
there are many approaches. if the project is simple, you can do it that way. note that components re-render whenever any part of an atom they reference changes, so you may find it a good practice to create cursors to the specific portion of the top-level atom. i find it helpful to keep all state mutators in a separate file and ensure that they are synchronous rather than mutating the state atom directly.
You can also keep truly local state locally instead of in the top-level atom. Once you start sharing it between components, it is probably better to put it in a central place.
@lee.justin.m my example is more like a single api call to get some data, and the various components in the app will use that same info (potentially)
and I may have a second call where I might mutate that data before I send it back to the server
this is all a bit abstract. if you have very simple dataflow, it almost doesn’t matter how your structure. the key thing that reagent does for you is implement an observer pattern where components re-render when any part of a ratom they have dereferenced during their render function changes