              )
            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))

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

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