Skip to content

Instantly share code, notes, and snippets.

@dillonforrest
Last active January 3, 2016 09:49
Show Gist options
  • Save dillonforrest/8445115 to your computer and use it in GitHub Desktop.
Save dillonforrest/8445115 to your computer and use it in GitHub Desktop.
figuring out cljs's Om by David Nolen

This is what I used to have:

(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
    (om/build-all item (:items state))))
    
;;; mount!!

(om/root app-state list (.getElementById js/document "some-id"))

That static-data list comprehension might be the reason behind it failing. I get this error in my Chrome console: Uncaught Error: Cannot build Om component from non-cursor {:a "some" :b "fake" :c "data"}.

Any thoughts?

@dillonforrest
Copy link
Author

pardon missing closing parens :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment