Created
November 13, 2016 21:38
-
-
Save zehnpaard/b31dfbffee6b62cf533d42fc81986f2b to your computer and use it in GitHub Desktop.
Reagent Form-2 Component Nesting (Purely Demonstrative Purposes)
This file contains hidden or 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 clicker.core | |
(:require [reagent.core :as r])) | |
(defn clicker [] | |
(let [john? (r/atom true)] | |
(fn [] | |
(let [clicks (r/atom 0)] | |
(fn [] | |
[:div | |
[:h1 {:on-click #(swap! john? not)} (if @john? "John" "James")] | |
[:p {:on-click #(swap! clicks inc)} "Clicks: " @clicks]]))))) | |
(r/render | |
[clicker] | |
(js/document.getElementById "app")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment