This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-21
Channels
- # aleph (2)
- # announcements (2)
- # babashka (10)
- # beginners (117)
- # calva (11)
- # cider (19)
- # clj-kondo (27)
- # cljs-dev (24)
- # cljsjs (1)
- # clojure (73)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-nl (47)
- # clojure-spec (23)
- # clojure-uk (28)
- # clojurescript (71)
- # cursive (7)
- # data-science (17)
- # datascript (1)
- # datomic (7)
- # duct (23)
- # emacs (23)
- # fulcro (6)
- # graalvm (41)
- # jobs (2)
- # luminus (1)
- # malli (1)
- # off-topic (151)
- # pathom (1)
- # portkey (10)
- # re-frame (12)
- # reitit (17)
- # shadow-cljs (158)
- # spacemacs (14)
- # sql (8)
- # tools-deps (17)
- # xtdb (9)
I have just added a new library(taoensso/tempura ) to my Clojurescript project. In advanced compilation I get a warning with 'unreachable-code'. Do I need to write an 'extern' for this?
Such updates on Clojurescript make me smile (1.10.520 1,857,158 bytes -> 1.10.597 1,779,276 bytes). 👍
I am using Semantic UI in a Reagent/Re-frame project. I have a data list that I would like to put inside an accordion component. An accordion is composed of a series of
[:> Accordion.Title "First Title"] [:> Accordion.Content "First content"]
inside a [:> Accordion ...]
The issue I am having is that when I am mapping over the data set. Using map-index
I'd have to wrap those two components in a [:div]
to prevent the mapping from only returning the last element. Doing so prevents the accordion from working. How can I go about this?
Seems like you want a React fragment. I assume reagent has support for emitting those
Hey folks, hope your thursdays are going great -- I am continuing to work on my re-frame project. I've ran into a tricky problem -- I am struggling to figure out how to dispatch marked selections into db. Here is how the app looks and code is below. The idea here is that a user selects attributes, from which the pull data button will slurp a csv out of the db based on their seleciton.
the idea here is that after selecting a one (or multiple) headers, the app db gets updated. each column has its own map in db. so for the above marked example, the end resulting db would be. not sure where to attach the dispatch function in this case.
{:firm-type {"sellside"}
:firm-info {"shorthand"}
:user-info {"full-name"}
:visibility {"not-visible"}
:focuses {"asset-class"}}
I am not sure where in my code should I register the dispatch so it maps values in db.
[:select {:multiple "multiple"}
(for [val focuses]
[:option val])]]
I assume we would have a dispatch here but i can't seem to make it work
You probably need to read this: https://reactjs.org/docs/forms.html#the-select-tag
will do, thanks zhenya 🙂
Also, your for
loops that create options will likely generate a React warning about them missing keys.
yes they do, nice!!
Since the lists of all the options are short, just use into
:
(into [:select {:multiple "multiple"}]
(map #(vector :option %))
options)
from here, where would I attach the :on-click dispatch event?
You don't need on-click
per option, you need on-change
for the whole select. So, near :multiple
.
It also probably won't hurt to read through Reagent documentation and examples.
awesome i'll give it a shot.. yea I am very new not only to anything clojure, but also software dev.. yikes
appreciate the help a lot!
Why do li
gets wrapped in seq
? (map-to-html-list {:NESTED {:LIST [1 2]}})
returns [:ul ([:li :NESTED [:ul ([:li :LIST [:ul ([:li 1] [:li 2])]])]])]
Hello everyone, sorry if this has been answered a bazilion times but what's the quickest way to integrate npm dependencies into an existing leiningen/figwheel project? I found https://github.com/RyanMcG/lein-npm but I know some people are using shadow-cljs with lein. (I would like to add fullpage.js [https://github.com/alvarotrigo/fullPage.js] to an app i'm building)
Yep, I switched to shadow-cljs+deps quite some time ago, haven't looked back since.
Given what a friend shows me sometimes (he's a pure JS developer), working with shadow-cljs and NPM is even easier than it's in the JS world.
Hi! I’m trying to catch an exception with try-catch block, but it’s failing. Here is a code
(defn on-navigate [new-match]
(when new-match
(let [params (try
(reitit.coercion/coerce! new-match)
(catch :default _
{}))
new-match' (assoc new-match :params params)]
(rf/dispatch [:set-current-route new-match']))))
Can someone help?otherwise, it might be that it’s not throwing inside of coerce!
but somewhere else?
is it possible there's a lazy seq in your new-match'
and that's forced later outside of this try/catch?
Hey, how can I embed javascript code in hiccup, for example the google analytics code?
hm, it seems to include a list of script tags with src attributes: https://github.com/weavejester/hiccup/blob/edbfce02110ff2a7fd0b2044222fd638d6367e53/src/hiccup/page.clj#L76
I've got something like this:
window.dataLayer = window.dataLayer || [];
function gtag () { dataLayer.push(arguments); }
gtag('js', new Date());
And putting it in a string didn't work
Maybe put that code into it's own .js file (in assets or something), then do hiccup.page/include-js
@UQP5ZFTD2 thanks, haven't thought about that
[:script "..."] should work. What HTML do you get?
What version of hiccup are you using?
@UQ5EVP2LW I am using this library https://github.com/roman01la/uix, which uses it, I can't find the version though
Okay, it's using Hiccup syntax but very likely not the actual Hiccup library, so it's behavior is a little different and it probably auto-escapes by default for security reasons
This will probably work
[:script {:dangerouslySetInnerHTML {:html ".....your javascript..."}}]
It's based on Rum apparently. This is what I use for Rum:
(defn raw-html ([s] (raw-html :div nil s)) ([tag s] (raw-html tag nil s)) ([tag attrs s] [tag (assoc attrs :dangerouslySetInnerHTML {:html s})]))
Hi, is this an Emacs? I have never seen similar stacktrace. What setup so you use?
Nice, I should try CLJS more. Thanks!