   [component]
   (not (true? (gobj/get component "unmounted"))))
 
+(defn on-unmount!
+  "Register an unmount callback for `component`."
+  [this key f]
+  (set! (.-re$onUnmount this)
+        (assoc (or (.-re$onUnmount this) {})
+          key f)))
+
 (defn- wrap-props
   "Wraps :on-change handlers of text inputs to apply changes synchronously."
   [props tag]

  [this]
  (apply dissoc (get this :view/props) (get-in this [:spec/props :props/consumed])))

(def is-react-element? v-util/is-react-element?)


                                       ;; otherwise our async render loop can't tell if a component is still on the page.
                                       (gobj/set this "unmounted" true)

                                       (doseq [f (some-> (.-re$onUnmount this)
                                                         (vals))]
                                         (when f (f this)))
                                       (some-> state (remove-watch this)))
                  :view/did-update finish-lifecycle}])
       (reduce-kv (fn [obj method-k method]
