On 25 Jul 2014 8:21 PM, "Ryan Waters" <[email protected]> wrote:
>
> And for some reason I thought [Clojurescript] was added to the subject
line automatically; sorry  : (

Indeed it is.  I suppose Gmail is just displaying it without it because it
merged your sent message with the version that came back from the list and
decided to keep the original Subject.

> On Fri, Jul 25, 2014 at 1:18 PM, Ryan Waters <[email protected]> wrote:
>>
>> I just started learning Reagent (after learning some Om and Reactjs).
 Do Reagent components map 1:1 with Reactjs components?
>>
>> The code below only prints "parent done" to the console but produces no
lines of output for "done with child component".  It would suggest that, in
the end, there's only one Reactjs component even though I feel I should
have 1 + (length of app-state) components?
>>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>>
>> (enable-console-print!)
>>
>> (defn by-id [id]
>>   (.getElementById js/document id))
>>
>> (def app-state (atom (vec (for [n (range 5)] (hash-map :id n :item (str
"this is line " n))))))
>>
>> (defn list-item-
>>   [{:keys [id item]}]
>>   ^{:key id} [:div item])
>>
>> (def list-item
>>   (with-meta list-item-
>>     {:component-did-mount #(println "done with child component")}))
>>
>> (defn lister-
>>   []
>>   (let [state @app-state]
>>     [:div
>>       (for [x state]
>>         (list-item x))]))
>>
>> (def lister
>>   (with-meta lister-
>>     {:component-did-mount #(println "parent done")}))
>>
>> (reagent/render-component [lister] (by-id "logview"))
>>
>> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> --
> Note that posts from new members are moderated - please be patient with
your first post.
> ---
> You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to