This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-27
Channels
- # babashka (45)
- # beginners (44)
- # calva (3)
- # cider (14)
- # clara (4)
- # clj-commons (3)
- # clj-otel (4)
- # cljsjs (1)
- # cljsrn (111)
- # clojars (5)
- # clojure (62)
- # clojure-europe (14)
- # clojure-nl (2)
- # clojure-uk (4)
- # clojurescript (31)
- # community-development (16)
- # conjure (7)
- # cursive (9)
- # data-science (1)
- # datalevin (10)
- # docker (1)
- # emacs (20)
- # fulcro (7)
- # helix (10)
- # jobs (4)
- # lsp (22)
- # malli (35)
- # meander (12)
- # music (1)
- # nbb (2)
- # off-topic (5)
- # pathom (3)
- # quil (1)
- # re-frame (12)
- # react (6)
- # reagent (18)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (4)
- # ring (1)
- # shadow-cljs (10)
- # spacemacs (9)
- # tools-build (17)
Does anyone know where this init_BANG_()
comes from in this reagent template? https://github.com/reagent-project/reagent-template/blob/master/resources/leiningen/new/reagent/src/clj/reagent/handler.clj#L27
I have tried to search it for on google and the shadow-cljs documentation but can’t find anything about it.
Do you know why we need the _BANG_
though? What would be wrong with just .core.init!()
?
Oh, it’s because !
isn’t valid in JS identifiers, so it’s replaced with _BANG_
by the cljs compiler https://groups.google.com/g/clojure/c/jeg3LdDQnaU/m/F51jMVxKia0J
Hi, is there a way to avoid Cursive warn about symbols "cannot be resolved" when calling JS functions/properties from ClojureScript?
I am encountering the missing key issue in reagent.
[23069:0627/170711.447175:INFO:CONSOLE(451)] "Warning: Every element in a seq should have a unique :key: ([app.view.sidebar_item 3] [app.view.sidebar_item 3])
(in app.view.panes)", source: js/cljs-runtime/reagent.impl.template.js (451)
the app.view.sider_bar is a form-1 function. Where shall I pass the :key prop?Pass it however you like, just make sure that it’s consistent for the identity of each element. Then use either metadata or a :key
in the attributes map, e.g.
(map (fn [my-element-txt]
^{:key my-key} [:div my-element-txt])
my-element-txts)
or
(map (fn [my-element-txt]
(with-meta [:div my-element-txt] {:key my-key})
my-element-txts)
or
[:div {:key my-key} my-element-txt]
e.g. if you know that my-element-txt
is unique for each item above, you can use that instead of my-key
but the re-frame guys have probably written an excellent article on the matter, they tend to do that 🙂
Thanks. However your reply is based on :div
hiccup form. I have the following questions:
1. What about form-1 function. I am not sure if meta data works on form-1. Also, I didn’t spot any docs related with it on https://cljdoc.org/d/reagent/reagent
2. For the form [form-1-fn {:key my-key} my-element-txt]
, does that mean reagent will always take it for granted that the first argument of a function serves as the props map of a react component renderer function?
The metadata approach works on Hiccup vectors, not components.
If the second value in the Hiccup vector is a map, Reagent will check if it has :key
. But the metadata takes the precedence.
Also, you don't really need keys if you turns seqs into vectors. It doesn't always make sense, but often it does.
@p-himik Are you reading the source to get this knowledge? https://github.com/reagent-project/reagent/blob/master/src/reagent/impl/util.cljs/#L221
Hey ! what's your favorite forms library ? (do you even use one)
Tried rolling my own, but I don't think i have enough experience to get it right, ended up converging on something looking a lot like fork so I think it's a good idea to just use it
I also try to not roll my own, I prefer the fiexibility of just writing the forms by hand and having various tools at hand for doing repetitive tasks. I make little effort to keep forms DRY 🙂
there's some interesting hook based libs (assuming you're using react) https://github.com/unform/unform https://react-hook-form.com/get-started#Quickstart
I use https://formik.org/ a lot in React.
thanks for the suggestions guys !
Is there a clojurescript course/resource that walks you through ui/ux css basics? Typography, colors, structuring a frontend etc
Why would it be CLJS though? Sounds like it's purely about CSS, and there are tons of materials there.
Agreed, not sure conflating cljs with those topics makes sense. These two resources are good for cljs though: https://www.learn-clojurescript.com/table-of-contents/ https://funcool.github.io/clojurescript-unraveled/
Thumbsdown on the first link. There have already been a few confused people here while trying to go through that book. It expects you to know some concepts without making it explicit. The accompanying code is not great and is just confusing. Those are just the things that I can immediately remember.
It might be alright if you're a somewhat experienced developer. But at that point, that book is probably too basic.
@p-himik agreed that there a ton of resources out there but the clojure way of thinking and doing things has a special allure to me. Alex Miller’s clojure applied or Zach’s Elements of Clojure are nice examples. I would love a David Nolen book on the Elements of Web Design that covers stuff like this.
@p-himik agreed that there a ton of resources out there but the clojure way of thinking and doing things has a special allure to me. Alex Miller’s clojure applied or Zach’s Elements of Clojure are nice examples. I would love a David Nolen book on the Elements of Web Design that covers stuff like this.