   [component name]
   (some-> (.-refs component) (gobj/get name)))
 
-(def component-state (atom {}))
+
 
 ;; self-management of cljs props and state
 

         (when 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])))))))

   "componentDidUpdate"
   (fn [f]
     (fn [_ _]
       (this-as this
         (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])))))

   "render"
   (fn [f]
     (fn []
       (this-as this
         (let [element (f this
                          (get-in @component-state [this :props])
                          (get-in @component-state [this :state]))]
           ;; wrap in sablono.core/html if not already a valid React element
           (if (js/React.isValidElement element)
             element

         (binding [*use-prior-props* false
                   *use-prior* false]
           (when f (f this
                      (d/get @db this :props)
                      (d/get @db this :state)))))))

   "componentWillMount"
   (fn [f]
     (fn []
       (this-as this
         (binding [*trigger-state-render* false]
           (begin-subscriptions this (props this))
           (when f (f this))))))

   "componentWillUnmount"
   (fn [f]
     (fn []
       (this-as this
         (end-subscriptions this (props this))
         (when f (f this))
         (d/transact! db [[:db/retract-entity this]]))))

   "componentWillReceiveState"
   (fn [f]
     (fn []
       (this-as this
         (let [props (d/get @db this :props)]
           (update-subscriptions this props props)
           (when f
             (f this
                props
                (d/get @db this :state)
                (d/get @db this :prev-state)))))))

   "componentWillReceiveProps"
   (fn [f]
     (fn [props]

       (this-as this
         (let [prev-props (d/get @db this :props)
               next-props (expand-props this (.-cljs$props props))
               next-children (.-cljs$children props)]

           (d/transact! db [{:id         this
                             :prev-props prev-props
                             :props      next-props
                             :view-id    (or (:view-id next-props) (:id next-props))
                             :children   next-children}])

           (binding [*trigger-state-render* false
                     *use-prior-props* true]
             (update-subscriptions this prev-props next-props)
             (when f (f this prev-props next-props)))))))

   "shouldComponentUpdate"
   (fn [f]
