 (defn run-router [elem routes]
   "receives the dom element to append the router tree to and the Routes component"
   (.run js/ReactRouter routes (partial router-cbk elem)))
-
-(comment
-  "NOT API"
-  "this would be ideal but doesn't work because reactify-component adds a wrapper layer
-  that conflicts with react-router"
-  (defn routes[]
-    [Route {:name "app" :path "/" :handler app-page}
-     [Route {:name "about" :path "about" :handler about-page}]])
-)
-
-(comment
-  "CURRENT API"
-  "this is how you define routes for now
-  every handler is a reagent component"
-  (def routes
-    (Route {:name "app" :path "/" :handler app-page}
-      (Route {:name "about" :path "about" :handler about-page}
-        (Route {:name "nested" :path ":post_id" :handler nested-page}
-          (Route {:name "deeply-nested" :path ":comment_id" :handler deeply-nested-page})))
-      (DefaultRoute {:handler default-page-meta})))
-
-  )

(ns reagent-react-router.core
   (:require [reagent.core :as reagent :refer [atom]]
             [react-router :as router])) ;// this should become [cljsjs.react-router]

(def Link (reagent/adapt-react-class js/ReactRouter.Link))

             )
           args)))

(defn defroutes
  [r]
  (postwalk
    (fn [node]
      (if (vector? node)
        (let [[t p h & f] node
              route-name (if (= p "/") "app" p)]
          (cond
            (= t :route)            (apply Route {:name route-name :path p :handler h} f)
            (= t :default-route)    (DefaultRoute {:handler p})
            (= t :not-found)  (NotFound {:handler p})
            (= t :redirect)   (Redirect {:from p :to h})))
        node))
    r))

(defn- router-cbk
  [elem handler state]
  (js/React.render (js/React.createElement handler (js-obj "params" (.-params state))) elem))
