mirror of https://github.com/status-im/reagent.git
atom -> r/atom in all posts
This commit is contained in:
parent
8abb75b95d
commit
7c2455f858
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.anyargs
|
||||
(:require [reagent.core :as r :refer [atom]]
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.interop :refer-macros [.' .!]]
|
||||
[reagent.debug :refer-macros [dbg println]]
|
||||
[reagentdemo.syntax :as s]
|
||||
|
@ -11,7 +11,7 @@
|
|||
(def title "All arguments allowed")
|
||||
|
||||
(def ns-src (s/syntaxed "(ns example
|
||||
(:require [reagent.core :as r :refer [atom]]))"))
|
||||
(:require [reagent.core :as r]))"))
|
||||
|
||||
(defn hello-component [name]
|
||||
[:p "Hello, " name "!"])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.async
|
||||
(:require [reagent.core :as reagent :refer [atom]]
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.interop :refer-macros [.' .!]]
|
||||
[reagent.debug :refer-macros [dbg println]]
|
||||
[reagentdemo.syntax :as s]
|
||||
|
@ -10,11 +10,11 @@
|
|||
(def title "Faster by waiting")
|
||||
|
||||
(def ns-src (s/syntaxed "(ns example
|
||||
(:require [reagent.core :as reagent :refer [atom]]))"))
|
||||
(:require [reagent.core :as r]))"))
|
||||
|
||||
(defn timing-wrapper [f]
|
||||
(let [start-time (atom nil)
|
||||
render-time (atom nil)
|
||||
(let [start-time (r/atom nil)
|
||||
render-time (r/atom nil)
|
||||
now #(.now js/Date)
|
||||
start #(reset! start-time (now))
|
||||
stop #(reset! render-time (- (now) @start-time))
|
||||
|
@ -28,9 +28,9 @@
|
|||
[:p [:em "render time: " @render-time "ms"]]
|
||||
[timed-f]])))
|
||||
|
||||
(def base-color (atom {:red 130 :green 160 :blue 120}))
|
||||
(def ncolors (atom 20))
|
||||
(def random-colors (atom nil))
|
||||
(def base-color (r/atom {:red 130 :green 160 :blue 120}))
|
||||
(def ncolors (r/atom 20))
|
||||
(def random-colors (r/atom nil))
|
||||
|
||||
(defn to-rgb [{:keys [red green blue]}]
|
||||
(let [hex #(str (if (< % 16) "0")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.binaryclock
|
||||
(:require [reagent.core :as r :refer [atom]]))
|
||||
(:require [reagent.core :as r]))
|
||||
|
||||
(defn cell [n bit]
|
||||
[:div.clock-cell {:class (if (bit-test n bit)
|
||||
|
@ -35,8 +35,8 @@
|
|||
[column-pair (-> (.getMilliseconds date)
|
||||
(quot 10))])])
|
||||
|
||||
(def clock-state (atom {:time (js/Date.)
|
||||
:show-100s false}))
|
||||
(def clock-state (r/atom {:time (js/Date.)
|
||||
:show-100s false}))
|
||||
|
||||
(defn update-time []
|
||||
(swap! clock-state assoc :time (js/Date.)))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.clockpost
|
||||
(:require [reagent.core :as r :refer [atom]]
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.interop :refer-macros [.' .!]]
|
||||
[reagent.debug :refer-macros [dbg]]
|
||||
[reagentdemo.syntax :as s]
|
||||
|
@ -42,7 +42,7 @@
|
|||
[:div.demo-text
|
||||
|
||||
[fn-src (s/syntaxed "(ns example
|
||||
(:require [reagent.core :as r :refer [atom]]))")]
|
||||
(:require [reagent.core :as r]))")]
|
||||
|
||||
[:p "We start with the basics: The clock is built out of
|
||||
cells, with a light colour if the bit the cell corresponds to
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.news050
|
||||
(:require [reagent.core :as r :refer [atom]]
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.interop :refer-macros [.' .!]]
|
||||
[reagent.debug :refer-macros [dbg println]]
|
||||
[reagentdemo.syntax :as s]
|
||||
|
@ -12,7 +12,7 @@
|
|||
(def new-in-alpha [:strong "New since 0.5.0-alpha: "])
|
||||
|
||||
(def ns-src (s/syntaxed "(ns example
|
||||
(:require [reagent.core :as r :refer [atom]]))"))
|
||||
(:require [reagent.core :as r]))"))
|
||||
|
||||
(def cel-link "http://facebook.github.io/react/docs/top-level-api.html#react.createelement")
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
|||
|
||||
|
||||
|
||||
(defonce person (atom {:name
|
||||
{:first-name "John" :last-name "Smith"}}))
|
||||
(defonce person (r/atom {:name
|
||||
{:first-name "John" :last-name "Smith"}}))
|
||||
|
||||
(defn input [prompt val]
|
||||
[:div
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(ns reagentdemo.news.undodemo
|
||||
(:require [reagent.core :as reagent :refer [atom]]
|
||||
(:require [reagent.core :as r]
|
||||
[reagent.interop :refer-macros [.' .!]]
|
||||
[reagent.debug :refer-macros [dbg println]]
|
||||
[reagentdemo.syntax :as s]
|
||||
|
@ -10,9 +10,12 @@
|
|||
(def url "news/cloact-reagent-undo-demo.html")
|
||||
(def title "Cloact becomes Reagent: Undo is trivial")
|
||||
|
||||
(def ns-src (s/syntaxed "(ns example
|
||||
(:require [reagent.core :as r]))"))
|
||||
|
||||
(def state todomvc/todos)
|
||||
|
||||
(def undo-list (atom nil))
|
||||
(def undo-list (r/atom nil))
|
||||
|
||||
(defn undo []
|
||||
(let [undos @undo-list]
|
||||
|
@ -36,8 +39,9 @@
|
|||
|
||||
(defn undo-demo []
|
||||
[demo-component {:comp todomvc-with-undo
|
||||
:src (s/src-of [:state :undo-list :undo :save-state
|
||||
:undo-button :todomvc-with-undo])}])
|
||||
:src [:pre ns-src
|
||||
(s/src-of [:state :undo-list :undo :save-state
|
||||
:undo-button :todomvc-with-undo])]}])
|
||||
|
||||
(def undo-demo-cleanup
|
||||
(with-meta undo-demo {:component-will-unmount
|
||||
|
|
Loading…
Reference in New Issue