Confusion around om functionality
(defn static-data []
(for [row (range 10)]
{:a "some" :b "fake" :c "data"}))
(def app-state (atom {:items (static-data)}))
;;; components
(defn item [_ _]
(om/component
(dom/div nil "I'm a row of data")))
(defn list [state _]
(om/component
(apply dom/div nil
(om/build-all item (:items state)))))
;;; mount!!
(om/root app-state list (.getElementById js/document.body))
I get this error in my Chrome console: Uncaught Error: Cannot build Om component from non-cursor {:a "some" :b "fake" :c "data"}
.
Why can't om create a cursor into this? Wouldn't it just be something like [:items n] Any thoughts?
To anyone who finds this, the restriction is that 'for' comprehensions, or filters/maps/etc return LISTS.
Om only operates on associative data structures, a list is not one of those.