          (let [update? (if f (binding [*use-prior* true
                                        *trigger-state-render* false]
                                (f this
-                                  (get-in @component-state [this :props])
-                                  (get-in @component-state [this :state])
-                                  (get-in @component-state [this :prev-props])
-                                  (get-in @component-state [this :prev-state])))
+                                  (d/get @db this :props)
+                                  (d/get @db this :state)
+                                  (d/get @db this :prev-props)
+                                  (d/get @db this :prev-state)))
                              ;; by default, update if props or state have changed
                              true)]
            update?))))

          {:keys [ref key] :as props} (when props? props)
          element (js/React.createElement
                    class
                    #js {:key        (or key
                                         (if-let [keyfn (.. class -prototype -reactKey)]
                                           (keyfn props) key)
                                         (.-displayName class))
                         :ref        ref
                         :cljs$props (dissoc props :keyfn :ref :key)
                         :cljs$children (when (not= '(nil) children) children)})]
      ;;
      #_(set! (.-reactClass element) class)

             {}
             (.-subscriptions this)))

(defn begin-subscriptions [this next-props]
  (doseq [{:keys [subscribe]} (vals (:subscriptions (state this)))]
    (subscribe next-props)))

(defn end-subscriptions [this prev-props]
  (doseq [{:keys [unsubscribe]} (vals (:subscriptions (state this)))]
    (unsubscribe prev-props)))

(defn update-subscriptions [this prev-props next-props]
  (when (seq (keep identity (filter (fn [{:keys [should-update]}] (and should-update (should-update prev-props next-props))) (vals (:subscriptions (state this))))))
    (update-state! this merge (initial-subscription-data this next-props))
    (end-subscriptions this prev-props)
    (begin-subscriptions this next-props)))

(def lifecycle-wrap-fns
  {"getInitialState"
