Skip to content

Instantly share code, notes, and snippets.

@atroche
Last active April 27, 2018 09:53
Show Gist options
  • Save atroche/f33614a0976cc6181bee30ad9a88be9c to your computer and use it in GitHub Desktop.
Save atroche/f33614a0976cc6181bee30ad9a88be9c to your computer and use it in GitHub Desktop.
(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