Last active
April 27, 2018 09:53
-
-
Save atroche/f33614a0976cc6181bee30ad9a88be9c 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 scratch.core | |
(:require | |
[reagent.core :as r] | |
[taoensso.tufte :as tufte :refer (defnp p profiled profile)])) | |
(enable-console-print!) | |
(tufte/add-basic-println-handler! {}) | |
(defonce props (r/atom {:todos 1})) | |
(defn c [prop] | |
[:strong (str prop)]) | |
(defn hello-world [] | |
[:div | |
[:h1 [c @props]]]) | |
(defonce loaded (atom false)) | |
(when-not @loaded | |
(r/render-component [hello-world] | |
(. js/document (getElementById "app"))) | |
(reset! loaded true)) | |
(defn change-props | |
[] | |
(p | |
:change-ratom | |
(reset! props {:todos (rand-int 9999999999)})) | |
(p | |
:flush-reagent | |
(r/flush))) | |
(profile | |
{} | |
(dotimes [_ 10000] | |
(change-props))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment