This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-01
Channels
- # aleph (7)
- # bangalore-clj (1)
- # beginners (89)
- # boot (5)
- # clara (21)
- # cljs-dev (2)
- # cljsrn (57)
- # clojure (58)
- # clojure-austin (1)
- # clojure-conj (1)
- # clojure-italy (5)
- # clojure-losangeles (3)
- # clojure-russia (4)
- # clojure-sanfrancisco (4)
- # clojure-spec (31)
- # clojure-uk (67)
- # clojurebridge (4)
- # clojurescript (56)
- # cursive (92)
- # data-science (4)
- # datomic (15)
- # emacs (23)
- # events (1)
- # fulcro (121)
- # gorilla (2)
- # jobs-discuss (1)
- # juxt (1)
- # lambdaisland (6)
- # lumo (13)
- # off-topic (11)
- # om (1)
- # onyx (17)
- # overtone (5)
- # parinfer (9)
- # planck (3)
- # re-frame (21)
- # reagent (95)
- # ring-swagger (7)
- # spacemacs (58)
- # vim (13)
- # yada (2)
@daiyi https://reagent-project.github.io/ is this what you are looking for?
not exactly, something more like this: https://re-view.io/docs/hiccup/syntax-guide where it tells me exactly the syntax
I've realised the only way I've learned to use reagent is by looking at someone else's reagent, and by testing random assumptions (can :class
take a vector of strings? hmm let's test it)
How do i detect how much i have scrolled in reagent? i was thinking to make
(when (> scrolled 500px)
[:button])
@lepistane you might get some inspiration or even a solution here: https://github.com/city41/reagent-scroll-demo
Retrieving com/cemerick/piggieback/0.1.6-SNAPSHOT/piggieback-0.1.6-20150223.163620-3.jar from clojars
Exception in thread "main" clojure.lang.ArityException: Wrong number of args (2) passed to: StringReader, compiling:(abnf.clj:189:28)
@reefersleep tnx for link btw
same error for me on lein figwheel
on lein uberjar
, I get a different error
probably a number of things wrong with that repo
but the demo looks great, so I’m guessing the logic is sound
think you can pretty much just replicate some of the code from the top of core.cljs
and all of scroll_chan.cljs
in a simple reagent-frontend lein
template project
to test it out
just uses core.async
and the google closure library (available in general for you when you use Clojurescript, I believe)
and of course reagent
i think i found what i need with this frame rate: 0 y: 212
i think i will just read the y from atom and show button if needed
yeah 🙂
if you’re using re-frame
, you could put the read and calculation in a subscription
if you’re using vanilla reagent
, you can just do it directly or wrap it in a reaction
or a something like that
that seems like the simples i might even play with scroll later on to learn more since there are few libs like you said. i am not. for this project as simple as possible, only reagent. yeah my thoughts exactly (on how to do it in reagent) thank you very much for your help you are very kind
couldnt make it happen but i just used this example to get what i need (yeah it's ugly but what can i do)
I’m curious if I could make it work now. Seems to me like that city41 guy has done almost all of the work. Maybe I’ll give it a go later today.
But if you have something that works, problem solved!
Is your solution on github?
I’d like to see it 🙂
@daiyi there's https://github.com/reagent-project/reagent/issues/302 but at this point it's only a plan
@pesterhazy this looks amazing! and is exactly what I'm seeking. thanks for kicking it off
Could you help me? This is my first re-frame/reagent chart “demo”. I created based on Mike instructions. But I get still nil at props.. what is the problem?
@sb I think it’s wrong to assume that :component-did-mount
is given the component itself as an argument
you’re feeding an arg to draw-demo-chart
, but it takes no args
so maybe a bit of argument confusion here 🙂
not sure
does it get called?
could you check that it gets called, and maybe print out whatever args it receives?
:compontent-did-update #(prn %1 %2 %3)
or whatever 🙂
#object[Constructor [object Object]] [#object[G__35256 "function (var_args){
var args = null;
if (arguments.length > 0) {
var G__35257__i = 0, G__35257__a = new Array(arguments.length - 0);
while (G__35257__i < G__35257__a.length) {G__35257__a[G__35257__i] = arguments[G__35257__i + 0]; ++G__35257__i;}
args = new cljs.core.IndexedSeq(G__35257__a,0);
}
return G__35256__delegate.call(this,args);}"] 0] nil
@daiyi in between travelling I'm working. Really nice co-working space here in Belo Horizonte :flag-br:
there's no caipirinha emoji 😞
I thought I could nudge you in the right direction with a quick tip, but I’m in over my head here 🙂
I think I might have been wrong in my assumption about :component-did-update
not receiving the component as an arg. Sorry! Feel like I’ve mislead you rather than help you
@sb, does this help? https://www.martinklepsch.org/posts/props-children-and-component-lifecycle-in-reagent.html
also you should narrow down your example a bit for testing - too much going on. Try to come up with a minimal example
but it’s always good to print whatever arguments you get, possibly with cljs.pprint/pprint
, and remember to keep track of what you’re printing where so you don’t confuse yourself.
And printing the (type of-something)
also helps sometimes
oh and yeah, @pesterhazy is right, way too much going on
@pesterhazy thanks, I hope will help for me. ( Unfortunately with google charts.. that is the minimal testing size..)
ah well
well for one thing there's re-frame in there, which is not necessary
if the problem is that you're seeing nil
props, try to focus on that first by passing static values etc
I got the values.. and the chart works fine without this. Ok, I go back .. and start to test again in different view point. Thanks the help 👍
no problem, I know it's often difficult to tease things apart
often that's the real task - separating the core of the problem from the incidental trappings
Hope you get it to work. Maybe I’ll take a look at it later on. Must say I’m a bit confused about exactly what the problem is, because there’s so much code and I don’t have a REPL handy 🙂
yup please let us know
Im back.. I get the data and I can prn out from this
update (fn [comp]
(let [{:keys [smth]} (reagent/props comp)]
(reset! gchart smth)
))
use waht outside the let?
(defn draw-demo-chart []
(let [gchart (atom nil)
update (fn [comp]
(let [{:keys [smth]} (reagent/props comp)]
(reset! gchart smth)
))
cols [["date" "X"] ["number" "YC"]]
rows (clj->js [[(new js/Date "07/11/14") 45] [(new js/Date "07/12/14") 15]
[(new js/Date "07/13/14") 23] [(new js/Date "07/14/14") 234]])
options (clj->js {:title (str "DAS CHART")})
canvas (new js/google.visualization.LineChart (.getElementById js/document "linechart"))]
(prn "outer" @gchart)
don't understand...
I got the value (update in every click) at update (fn [comp] ...
but I can’t use this var (in atom or not) after the let definitions (after "linechart"))]
you should be able to use gchart
anywhere inside of the let
of course on init time (where your prn
is) it's not set yet 🙂
not sure what you want to do
I would like to update the chart. Counter is just a test. I would like to use eg. in the title.