Skip to content

Instantly share code, notes, and snippets.

@LeifAndersen
Last active November 18, 2020 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeifAndersen/037507a44a0945fba2807b0bb63f28d6 to your computer and use it in GitHub Desktop.
Save LeifAndersen/037507a44a0945fba2807b0bb63f28d6 to your computer and use it in GitHub Desktop.
(ns sample.core
(:require [reagent.core :as r]
[reagent.dom :as d]))
(defn default-db []
{:counter (r/atom 0)
:label (r/atom "Count")})
(defn counter-view [db]
[:h1 (:counter db)])
(defn home-page [db]
[counter (select-keys db [:counter])])
(defn mount-root []
(d/render
[home-page (default-db)]
(.getElementById js/document "app")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment