title: How to I set up a SPA with clojure and clojurescript?
body: <p>I'm trying to follow this book: <a href="https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/" rel="nofollow noreferrer">https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/</a></p>
  <p>Based on the book, I'm trying to set up a simple SPA but I'm having trouble figuring out just how to set up basic pages to get started.</p>
  <p>Here is what I have in my core.cljs file:</p>
  <pre><code>(ns my-spa.core
    (:require
     [reagent.core :as r]
     [reagent.dom :as dom]
     [re-frame.core :as rf]
     [mount.core :as mount]))
  
  (defn about-page []
      (fn []
        [:div.content&gt;div.columns.is-centered&gt;div.column.is-two-thirds
         [:div.columns&gt;div.column
          [:h3 &quot;Welcome to the About Page!&quot;]]]))
  
  (defn home []
      (fn []
        [:div.content&gt;div.columns.is-centered&gt;div.column.is-two-thirds
         [:div.columns&gt;div.column
          [:h3 &quot;Welcome to the Homepage!&quot;]]]))
  
  (defn navbar []
    (let [burger-active (r/atom false)]
      (fn []
        [:nav.navbar.is-info
         [:div.container
          [:div.navbar-brand
           [:a.navbar-item
            {:href &quot;/&quot;
             :style {:font-weight &quot;bold&quot;}}
            &quot;miuminati&quot;]
           [:span.navbar-burger.burger
            {:data-target &quot;nav-menu&quot;
             :on-click #(swap! burger-active not)
             :class (when @burger-active &quot;is-active&quot;)}
            [:span]
            [:span]
            [:span]]]
          [:div#nav-menu.navbar-menu
           {:class (when @burger-active &quot;is-active&quot;)}
           [:div.navbar-start
            [:a.navbar-item
             {:href &quot;/&quot;}
             &quot;Home&quot;]
            [:a.navbar-item
             {:href &quot;/about&quot;}
             &quot;About&quot;]]]]])))
  
  (defn app []
    [:div.app
     [navbar]
     [:section.section
      [:div.container
       [home]]]])
  
  (defn ^:dev/after-load mount-components []
    (rf/clear-subscription-cache!)
    (.log js/console &quot;Mounting Components...&quot;)
    (dom/render [#'app] (.getElementById js/document &quot;content&quot;))
    (.log js/console &quot;Components Mounted!&quot;))
  
  (defn init! []
    (.log js/console &quot;Initializing App...&quot;)
    (mount/start)
    (rf/dispatch [:app/initialize])
    (mount-components))
  
  
  </code></pre>
  <p>How do I set up my <code>app</code> definition so that I can click on the Home-page button, or About-page button in the navbar, and get a page with both the navbar and the current page rendering?</p>
  <p>In the book there is this code:</p>
  <pre><code>(defn page [{{:keys [view name]} :data
               path                :path
               :as                 match}]
    [:section.section&gt;div.container
     (if view
       [view match]
       [:div &quot;No view specified for route: &quot; name &quot; (&quot; path &quot;)&quot;])])
  
  (defn app []
    (let [current-route @(rf/subscribe [:router/current-route])]
      [:div.app
       [navbar]
       [page current-route]]))
  </code></pre>
  <p>But I can never get that to work. I try copying and pasting code from the book, but there's something I'm missing. I made sure I had all the same functions and namespaces as the book but I always get the error message &quot;No view specified for route: ()&quot; and I don't know why it's not finding the view. If I just have the <code>app</code> function set to render the about page by itself, then it works. So I think it's something with how the pages are routing?</p>
  <p>Please let me know where to start? I'm feeling frustrated that I can't set up a simple webpage. I want to learn how to add more features but I want to start with the basics. I'll add any extra info as necessary.</p>
  <p>Also, do I need websockets for this?</p>
  <p>What am I missing?</p>