Fork me on GitHub
#reagent
<
2016-09-11
>
sreenath.n05:09:17

I am trying to use with my re-frame app. I could not find it in . So, could anyone help me on how to use it in my app?

yury.solovyov09:09:41

what is the blessed way of dealing with dynamic classes in components? like active or selected ? plain conditional does not seem to scale well...

artur09:09:03

How do I render HTML as HTML and not as escaped in Hiccup? Developing an app with Reagent.

olegakbarov11:09:29

Disclaimer — Reagent newbie here! How do i decorate a reagent component? I mean, how one can access props of component which is passed as a parameter to function? Here’s some code that illustrates the idea:

(defn comp []
  [:div "im test comp"])

(defn decorate [comp]
 ;; access comp props and state here?
  comp)

;; markup: 
...
[(decorate comp)]
...

mikethompson12:09:33

@olegakbarov in your markup there are no props supplied ... so I'm left wondering how you would imagine that happening

olegakbarov12:09:51

hmm, how about this:

(defn comp [name]
  [:div "im test comp with name:” name])

(defn decorate [comp]
 ;; access comp props and state here?
  comp)

;; markup: 
...
[(decorate comp “name")]

mikethompson12:09:21

(defn comp 
  [name]
  [:div "im test comp with name:" name])

(defn decorate 
  [comp & props]
  (into [comp] props))         ;; <---- will produce  [comp "name"]

;; markup: 
[decorate comp "name"]      ;; <---- I took out the ()

olegakbarov13:09:34

aha! what about access to state and lifecycle hooks?

mikethompson13:09:01

You'll have to be more specific

mikethompson13:09:40

We don't tend to use React's .state in Reagent

olegakbarov13:09:06

okay, thank you! i need to play a round a little more with code to come back with more specific questions

mikethompson13:09:36

It sounds like you have a React background

mikethompson13:09:06

And you are looking for the Reagent analogs

olegakbarov13:09:21

yes correct, i’ve built a couple apps with React/Redux and now wrapping my head around Reagent and CloujureScript as a whole

mikethompson13:09:40

If you have used Redux, then you will want to look at re-frame

mikethompson13:09:46

(Warning: I'm the author)

olegakbarov13:09:54

i already use it!

mikethompson13:09:04

There is a #re-frame channel

mikethompson13:09:34

For those kind of questions ... although obviously your questions above are very appropriate for this channel

olegakbarov13:09:14

actually my question derives 😉 from the problem i have with ClojureScript

olegakbarov13:09:52

i’m looking for idiomatic way to do drag-and-drop

mikethompson13:09:08

Well, Reagent does mess with your understanding of function calls when you first start 🙂

mikethompson13:09:43

Make sure you read the pages under "Reagent Tutorials" in here https://github.com/Day8/re-frame/wiki (You probably have, but just in case)

olegakbarov13:09:46

yea, i’ve read it and pretty sure i’ll come back for more

olegakbarov13:09:10

now i’m thinking about ways of porting (or rewriting) http://gaearon.github.io/react-dnd/ in clojure

olegakbarov13:09:41

and thus DnD relies heavily on HoC, i wanted to explore this topic in Clojure

olegakbarov13:09:47

i’m a little surprised nobody have explored this stuff in ClojureScript community

olegakbarov13:09:04

too bad i’m such a newb to port it fast!

olegakbarov13:09:19

all ideas are welcome btw!