This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-12
Channels
- # aws (3)
- # beginners (28)
- # boot (3)
- # cider (28)
- # clara (5)
- # cljs-dev (107)
- # cljsrn (1)
- # clojure (40)
- # clojure-austin (2)
- # clojure-brasil (5)
- # clojure-canada (1)
- # clojure-italy (1)
- # clojure-spec (39)
- # clojure-uk (38)
- # clojurescript (33)
- # community-development (11)
- # cursive (11)
- # datomic (43)
- # duct (6)
- # emacs (7)
- # flambo (1)
- # fulcro (68)
- # graphql (11)
- # jobs (1)
- # jobs-discuss (8)
- # leiningen (16)
- # luminus (2)
- # lumo (1)
- # off-topic (38)
- # om (2)
- # onyx (15)
- # parinfer (32)
- # portkey (5)
- # re-frame (50)
- # reagent (50)
- # reitit (1)
- # shadow-cljs (63)
- # spacemacs (10)
- # sql (27)
- # unrepl (6)
- # yada (2)
@faxa here you have all mouse events from react https://reactjs.org/docs/events.html#mouse-events
(defn stop-propagation [e]
(.stopPropagation e))
(defn component []
[:> Foo {:on-drag stop-propagation}])
[:div {:id "elId"}] (set! (. (. js/document getElementById "elId") -innerHTML) "<b>Bold!</b>")
@eveko take a look at this for an example https://github.com/reagent-project/reagent/issues/14
how can I understand what [:>
exactly expands into.
is it same as (reagent/create-class {
so I can write [:> :reagent-render [:hiccup]...
and so on?
@faxa no it isn't, take a look at this http://reagent-project.github.io/news/news060-alpha.html
@gadfly361 hanks I can see now! so I can override any lifecycle method on adapted class like [:> :component-did-mount
or I do have to wrap it into my own class.
@gadfly361 an other user @mateusz.probachta advised that `(defn component [] [:> Foo {:on-drag stop-propagation}])` would work and it does on some cases. Right now I am very puzzled. :face_with_monocle:
@faxa i think you are confused because :> is syntactic sugar for adapt-react-class .. not create-class
@faxa according to the link above it is sugar for [(adapt-react-class ReactComponent) props]
. it has no documentation other than that single paragraph and it is basically impossible to search for, so i’d stick with adapt-react-class
if i were you 🙂
@lee.justin.m the code is https://github.com/reagent-project/reagent/blob/v0.7.0/src/reagent/impl/template.cljs#L306 Just FYI (not saying to use it)
Yeah, the keyword is translated to a string via name
which removes the :
char, so you don’t end up finding the :>
in the code via a search
i found comment before but i didn’t read carefully enough to realize that this was actually implementing it. i was expecting it to be defined like a normal reagent function/component. it is interesting that it is special cased right into the parsing code
Yeah, I’m not sure on exactly why other than that is where it needs to handle the native components vs reagent fn style components
so the :>
it isn’t exactly the same as adapt-react-class
. :>
basically creates an instance of the react component directly, as far as i can tell, whereas adapt-react-class
takes the react component and constructs a deftype NativeWrapper
from the component. i don’t quite understand if there is any practical difference, though
actually ignore the previous comment. they both end up as calls to (native-element #js{:name comp} ...)
@lee.justin.m They are nearly the same thing it seems from the impl. I once thought that there was some sort of runtime performance advantage of using adapt-react-class
instead of the inline :>
style. However, it isn’t looking much different when looking at the implementation. I could be missing something though.
yea i don’t think so either. except for the call to adapt-react-class
itself, which is trivial, I’m pretty sure there is no difference
@mikerod do you know who “owns” this project? there is a lot of great documentation on reagent, but I’m trying to understand why it isn’t making its way back into the github project.
https://github.com/reagent-project/reagent/graphs/contributors gives some guesses, but that’s it for what I know.
i looked at that before. i have this sneaking suspicion that the problem is that this thing is Dan Holmsand’s baby, but he isn’t super involved any more, so now nobody really feels like they own it anymore
@lee.justin.m there is truth to Dan being less involved, but the project is being looked after largely by @juhoteperi these days (and also @yogthos @mikethompson)
I'm currently mostly interested about technical improvements (better test runners, getting 0.8 out & improving ClojureScript JS module support), so I haven't mostly looked into updating site or docs
The Re-frame Reagent docs are probably mostly written by @mikethompson? If there is benefit in maintaining them on Reagent repo it should be easy to copy them to wiki, or add to docs folder, which we could later publish as site
If I understand correctly, re-frame wiki docs (where reagent docs are) are legacy and docs/
folder is the new docs?
And if someone is interested in contributing to docs and site, I can accept such pull requests quickly (i.e. no release, no changes to lib code)
I might have some time in the coming weeks (i.e., end of February) to take a stab at helping with documentation
the things I would like to see, and will help with if desired: [1] install a “guide” tab at the top of http://reagent-project.github.io/ right next to the “intro” tab that looks something like this https://purelyfunctional.tv/guide/reagent/. [2] fill out the api docs, which are woefully incomplete. [3] go through the news releases and incorporate every precious nugget of information in there in either the guide or the api, [4] write an interop guide
hey all, check out this super cool and fantastic reagent + re-frame project that I made!
@juhoteperi I'd be very happy to move my various docs across in reagent's /docs
. I feel it should have happened already.
I think we have to take a "make small wins" approach to the docs.
We have the beginnings of a docs
folder:
https://github.com/reagent-project/reagent/blob/master/docs/README.md
Those three new documents you see used to be in the re-frame Wiki, but they have now been removed from the Wiki and redirected to their new equivalent.