Hi,

I have a use-case where the component is given an id and it uses a generic 
'reference-data' (e.g. :location/render) subscription to render. Is it possible 
and idiomatic to do something like:

(register-sub 
  :location/render 
  (fn [db [id]] ....))

(defn row 
  [{:keys [location-id]}]
  (let [location-desc (subscribe [:location/render location-id])
  (fn [state]
    [:tr [:td @location-desc]]))

(defn rows [results]
  [:tbody
    (doseq [r results]
      [row r])])

My understanding is that it isn't as 'row' is a form-2 component and the data 
passed to the 'row' form is scoped to the constructor whereas the 'state' 
passed to the fn returned by 'row' is per-invocation.

In which case I do:

(defn row 
  [{:keys [location-id]}]
  (let [location-desc (subscribe [:location/render location-id])
    [:tr [:td @location-desc]])

Which feels wrong, but it might be fine.

Clarity please :).

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to