You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably PEBCAK.
I have the following tiny application using secretary and reagent. Calls to secretary/dispatch! like the one at the bottom of the file update the application as expected. Clicking on the links, however, does not result in a call to dispatch.
Any pointers you can provide will be appreciated. Thanks in advance!
(ns askit-client.main
(:require [reagent.core :as reagent]
[secretary.core :as secretary :refer-macros [defroute]]))
(enable-console-print!)
;; Define reagent components
(defn home []
[:div [:h1 "Welcome, friend!"]
[:div [:a {:href "#/about"} "about us"]]])
(defn about []
[:div "Now you know all about us!"
[:div [:a {:href "#/"} "go home"]]])
(defn current-page [] [(@app-state :current-page)])
;; Set up application state
(def app-state (reagent/atom {}))
(defn put! [k v] (swap! app-state assoc k v))
(put! :current-page home)
;; Define secretary routes
(secretary/set-config! :prefix "#")
(defroute "/" []
(println "time to go home")
(put! :current-page home))
(defroute "/about" []
(println "time to go about")
(put! :current-page about))
(println "Let's mount this thing and go home!")
(reagent/render-component [current-page] (.getElementById js/document "app"))
(secretary/dispatch! "/about")
The text was updated successfully, but these errors were encountered:
This is probably PEBCAK.
I have the following tiny application using secretary and reagent. Calls to
secretary/dispatch!
like the one at the bottom of the file update the application as expected. Clicking on the links, however, does not result in a call to dispatch.Any pointers you can provide will be appreciated. Thanks in advance!
The text was updated successfully, but these errors were encountered: