Skip to content

Instantly share code, notes, and snippets.

Created August 12, 2015 14:38
What would you like to do?
Om state test
(defonce app-state (atom {:text "51"}))
(fn [data owner]
(reify om/IRender
(render [_]
(dom/div nil
(dom/p nil "Enter some numbers:")
(dom/input #js {:value (:text data)
:onChange (fn [e]
(let [input-txt
input-number (first (re-seq #"\d+" input-txt))]
(om/update! data [:text] input-number)))})
(dom/pre nil "Value: " (pr-str (:text data)))))))
{:target (. js/document (getElementById "app"))})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment