This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-13
Channels
- # adventofcode (84)
- # aleph (1)
- # announcements (2)
- # aws (27)
- # beginners (52)
- # braveandtrue (2)
- # calva (440)
- # cider (7)
- # clara (2)
- # cljdoc (26)
- # cljs-dev (70)
- # clojure (131)
- # clojure-berlin (4)
- # clojure-brasil (1)
- # clojure-europe (2)
- # clojure-greece (4)
- # clojure-hamburg (1)
- # clojure-italy (4)
- # clojure-losangeles (6)
- # clojure-nl (14)
- # clojure-spec (7)
- # clojure-uk (25)
- # clojurescript (26)
- # component (2)
- # cursive (13)
- # datomic (60)
- # dirac (59)
- # docker (1)
- # figwheel (1)
- # figwheel-main (2)
- # fulcro (12)
- # graphql (5)
- # juxt (33)
- # leiningen (19)
- # nrepl (1)
- # off-topic (37)
- # protorepl (2)
- # re-frame (18)
- # reagent (46)
- # remote-jobs (1)
- # ring-swagger (1)
- # shadow-cljs (88)
- # sql (10)
- # tools-deps (64)
- # vim (24)
@dante.the.monkey :npm-deps
+ :target :node
will probably just work for you since that skips Closure
I think I misunderstood some documents I was reading. :foreign-libs was what I was after. Found a nice tutorial at lambdaisland that helped make sense of it
I think the library I'd be using is EC6 as well, so I should be able to pull it in using the :model-type key
I'm still wrestling a bit with the best way of using JS libraries. Is anyone happily using :npm-deps
(in a browser based project) I've heard there are a bunch of libraries that don't work. Why is this and is there any workarounds?
@curlyfry i have not tried :npm-deps
. rather using webpack (https://clojurescript.org/guides/webpack) instead, for my browser project. Except for the initial hurdle with setting up yarn
and understanding webpack config, it has been quite good. i have included multiple npm libs like react
, @material-ui
, d3
and they seem to work fine.
@pradyumna Cool, that method seems to work quite well. It's unfortunate that it brings the whole webpack machinery with it, though. I think one of the main issues with that approach is that it's a lot off stuff to learn if you're a beginner and just want to use a JS lib from cljs
yes, it brings in webpack. what i liked was it decoupled cljs from npm. actually i was facing issues with the npm itself. now, once bundling is done, then no more issues related npm while working with cljs.
if you don't want to deal with webpack you could try shadow-cljs. it supports pretty much all npm packages
@thheller That pretty much excludes using figwheel, right? I'd still very much like to use that, for example for the testing functionality. I know shadow has live reload functionality as well.
@souenzzo Are you wanting to go from something like #js {:a 1 :b 2}
to #js [#js ["a" 1] #js ["b" 2]]
? I don't recall anything like that, but goog/forEach
gets close. What are you trying to do?
Maybe a little code like this would do it
(let [o #js {:a 1 :b 2}]
(map #(vector % (goog.object/get o %)) (js-keys o)))
I did almost it. I just need to turn a js map into a clojure map, but js->clj don't work because it's a odd js map
Is it possible to store components in a reagent/atom? I am working on a web app that has a UI that is broken into a side navbar on the left and a "workspace" on the right. When you click options on the side bar it should change the workspace to reflect the item you want to work on. Can I:
(defn work-space
[]
[@work-space-state])
then reset!
the @work-space-state
with the name/symbol of a component?
So, there would be an on-click
attribute with #(reset! @work-space-state item-view-component)
why not store the state of the components and an indicator of which component you are in?
@dpsutton like just store a string in the @work-space-state
atom?
i used a keyword like :user-editor
but you could use whatever values you want to indicate which component should be focused
The app let's a user work with tabular data. The left side bar has user account options like settings then a button to create a table then a list of their tables. If they click on one of the tables or say, settings, the entire work-space
div changes to hold a table-view
component or the setttings-view
component. So, in my work-space
component should I just deref the work-space-state
and have a bunch of if statement to check which component should be nested in the work-space
div?
(defn work-space
[]
(if (= @work-space-state "table-view")
[table-view]
etc..sorry bout that
haha definitely
ok thanks @dpsutton