-
-
Save vitaly-pushkar/61daa08c9cefb78a5395 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.core | |
(:require [reagent.core :as reagent] | |
[example.app :as app :refer [global-state]] | |
[example.routes :as routes] | |
[example.views.layout :as layout])) | |
(defn layout-render [] | |
[layout/menu] | |
[(global-state :current-screen)]) | |
(defn app-component [] | |
(reagent/create-class {:component-will-mount routes/app-routes | |
:render layout-render})) | |
(reagent/render-component [app-component] (.-body js/document)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns example.routes | |
(:require [secretary.core :as secretary :refer-macros [defroute]] | |
[example.app :as app :refer [global-put!]] | |
[example.views.screens :refer [screens]] | |
)) | |
(defn app-routes [] | |
(secretary/set-config! :prefix "#") | |
(defroute "/" [] | |
(global-put! :current-screen (screens :budget-screen))) | |
(defroute "/journal" [] | |
(global-put! :current-screen (screens :journal-screen))) | |
(defroute "/savings" [] | |
(global-put! :current-screen (screens :savings-screen))) | |
(defroute "/settings" [] | |
(global-put! :current-screen (screens :settings-screen)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment