Fork me on GitHub

@dante.the.monkey :npm-deps + :target :node will probably just work for you since that skips Closure

Dante T. M.03:12:28

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

Dante T. M.03:12:12

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 ( 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.


shadow-cljs also has testing functionality


there is something like Object.entries in goog lib?


@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)))

👍 4

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?


sure. {:selected-component :user-editor :state {:first-name ....}}


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")


you can use triple backticks for multiline


sorry bout that


no worries. just for your sanity 🙂


that's the general idea. build it as general as you like


haha definitely