This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-02
Channels
- # admin-announcements (4)
- # aleph (10)
- # arachne (1)
- # beginners (66)
- # boot (19)
- # cider (6)
- # cljs-edn (2)
- # cljs-site (32)
- # cljsjs (4)
- # cljsrn (32)
- # clojure (116)
- # clojure-austin (6)
- # clojure-belgium (2)
- # clojure-dusseldorf (1)
- # clojure-russia (16)
- # clojure-uk (5)
- # clojurescript (178)
- # community-development (2)
- # cursive (28)
- # datascript (16)
- # datomic (16)
- # dirac (13)
- # editors (2)
- # emacs (1)
- # error-message-catalog (30)
- # events (3)
- # garden (2)
- # hoplon (27)
- # jobs (4)
- # ldnclj (4)
- # liberator (3)
- # off-topic (6)
- # om (49)
- # onyx (24)
- # parinfer (9)
- # re-frame (59)
- # reagent (46)
- # remote-jobs (1)
- # rethinkdb (4)
- # rum (2)
- # slack-help (11)
- # untangled (13)
is the snapshot version doing the same as this:
[cljsjs/react "15.0.1-1"]
[cljsjs/react-dom "15.0.1-1"]
[reagent "0.6.0-alpha" :exclusions [cljsjs/react cljsjs/react-dom]]]
or are there other changes?
can someone explain to me how ^{:key 1} [div]
works? I don't understand why the syntax is like that, instead of [:div {:key 1}]
That's attaching metadata, @bojan.matic, which reagent uses to tell react what the keys should be.
actually so if you go here you can see that problem: http://cljsfiddle.com/#gist=99cf69414d4f49be3b154c115b938361
in the console there's our favorite warning about Every element in a seq should have a unique :key: ([:h1 "O"] [:h1 "X"])
😒
but, http://cljsfiddle.com/#gist=453b088867f8f6a9592504a850fc2032 does not have the warning!!
in fact, here you can see what (into [:div] ... does: http://cljsfiddle.com/#gist=709027a0c4de0f70280ef5a265c42a4b
maybe this is a better gist... http://cljsfiddle.com/#gist=27ddc05532806b1a1aaaa60a6139bcf4
what is the ^{:key}
syntax? how does the property get inserted into the element that is a sibling there?
what is the ^
character?
that's what i'm not getting
@bojan.matic: every Clojure object can have "metadata" attached to it
@bojan.matic: Its a special char in Clojure that helps to set metadata
See http://clojure.org/reference/metadata - Search that page for ^
so is the ^
character a macro?
metadata is extra information that doesn't influence the value of something, so two things can have different metadata but still be considered equal
reader macro?
Clojure has a reader macro
http://clojure.org/reference/reader - Search for Metadata
ok, that explains it
thanks a lot!
i thought i read somewhere that clojure does not have reader macros?
Clojure does not allow you to add your own ...
(I am going to stop typing - it seems @plexus and I have the same thoughts in the same sequence ... like Slack echo in here 😄 )
thanks a lot guys! @looselytyped @plexus
whether a var is private, whether it can be rebound, the doc string, are all attached as metadata
also clojure.test
defines vars that have the test code attached as ^{:test (fn [] ...)}
metadata (and you can add ^{:test ...}
inline to your functions and the test runner will pick it up
nice, thanks
i also see how it gives totally different output in cljs repl