Skip to content
This repository was archived by the owner on Aug 12, 2026. It is now read-only.

Commit 7b1a3d3

Browse files
committed
Remove unnecessary (fn []) wrapper from defc example in README
defc macro auto-wraps body in render fn. The inner (fn []) is supported (creates a reactive bind) but is not needed for this simple example.
1 parent 92cc946 commit 7b1a3d3

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,10 @@ su provides reactive Web Components using ClojureScript + Shadow DOM:
232232

233233
(defc my-counter [{:keys [initial]}]
234234
(let [count (atom (or initial 0))]
235-
(fn []
236-
[:div.counter
237-
[:span "Count: " @count]
238-
[:button {:on-click #(swap! count inc)} "+"]
239-
[:button {:on-click #(swap! count dec)} "-"]])))
235+
[:div.counter
236+
[:span "Count: " @count]
237+
[:button {:on-click #(swap! count inc)} "+"]
238+
[:button {:on-click #(swap! count dec)} "-"]]))
240239

241240
(defstyle my-counter
242241
[:.counter {:display "flex" :gap "8px" :align-items "center"}]

0 commit comments

Comments
 (0)