File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1463,11 +1463,11 @@ file for the client UI.
14631463(defonce todos
14641464 (js/document.getElementById "todos"))
14651465
1466- (defonce state (atom {}))
1466+ (defonce store (atom {}))
14671467
14681468(defn update-todos []
14691469 (a/go (let [resp (<! (http/get "/todos"))]
1470- (swap! state assoc :todos (-> resp :body :results)))))
1470+ (swap! store assoc :todos (-> resp :body :results)))))
14711471
14721472(defn delete-todo [id]
14731473 (a/go (<! (delete (str "/todos/" id)))
@@ -1492,10 +1492,14 @@ file for the client UI.
14921492 [:a {:href "#" :on {:click #(delete-todo id)}} "delete"]])
14931493 [:li (create-todo-form)]])
14941494
1495- (add-watch state ::render (fn [_ _ _ s] (r/render todos (todo-list s))))
1495+ (add-watch store ::render (fn [_ _ _ s] (r/render todos (todo-list s))))
14961496(update-todos)
14971497----
14981498
1499+ WARNING: In the above example, the '`click`' event is bound to a function.
1500+ This is not considered best practice for Replicant, but used in the
1501+ example code for the sake of brevity.
1502+
14991503Here we reach the edge of Duct. This ClojureScript file is not specific
15001504to our framework, but would be at home in any Clojure project.
15011505Nevertheless, for the sake of completeness we'll provide some
You can’t perform that action at this time.
0 commit comments