Fork me on GitHub
#reagent
<
2016-10-17
>
mikethompson05:10:12

New version of re-com. We called it v1.0.0 It has one annoying backwards-incompatible change (sorry): https://github.com/Day8/re-com/releases

michal20:10:47

hi, what’s the best way to get a reference to component in other component’s event handler? is it possible with reagent?

olegakbarov20:10:35

are there ways to work with react context in reagent?

olegakbarov20:10:58

grep’ed the src, but seems there’re no such feature

jrheard20:10:01

hi - i’m sure i’m doing something simple wrong here. making a slider for the first time, here’s my code:

(defn slider [an-atom min max]
  (js/console.log "slider" @an-atom)
    [:input {:type      "range" :value @an-atom :min min :max max
             :style     {:width "100%"}
             :on-change (fn [e]
                          (reset! an-atom (js/parseInt (.-target.value e))))}])


; invocation
   [slider grid-width 25 35]
the behavior i’m seeing is: the slider’s displayed position never changes, but clicking/dragging on it successfully changes the value of its input atom. i’d like the slider’s position to reflect the current value of its atom - what am i doing wrong?

jrheard20:10:22

i don’t see my console.log called when the slider is manipulated, which seems like a warning sign

gadfly36121:10:58

Think your atom isnt reactice bc i just used your code and it seems to work

jrheard21:10:00

ah, its parent component doesn’t have grid-width passed to it, so i bet reagent never sees it as an input atom <— this was irrelevant, pretend i never said this

jrheard21:10:09

thx gadfly 🙂

jrheard21:10:40

oh lol also it’s not an r/atom, you’re 100% right

gadfly36121:10:44

i do that all the time! 😁

jrheard21:10:20

learning how to generate random levels in roguelikes, built a little tool to help me understand what the algorithms are actually doing

jrheard21:10:53

kinda soothing to look at

jrheard21:10:21

(i’ve only implemented the most basic possible algorithm for this so far, there’ll eventually be others 🙂 )