Skip to content

Commit

Permalink
Remove need for initialising counter in demonstration of counter incr…
Browse files Browse the repository at this point in the history
…ement pattern by wrapping inc with fnil. (#553)
  • Loading branch information
clojureman authored and Bruce Hauman committed Jun 30, 2017
1 parent 7bec9ee commit a61a444
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/dev/example/dev.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
:on-jsload (fn []
;; it can be helpful to touch the state on
;; reload to cause a re-render
(swap! core/app-state update-in [:__figwheel_counter] inc))})
(swap! core/app-state update-in [:__figwheel_counter] (fnil inc 0)))})

2 changes: 1 addition & 1 deletion examples/implicit-js-reloading/src/example/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
(defn on-js-reload []
;; optionally touch your app-state to force rerendering depending on
;; your application
;; (swap! app-state update-in [:__figwheel_counter] inc)
;; (swap! app-state update-in [:__figwheel_counter] (fnil inc 0))
)


2 changes: 1 addition & 1 deletion examples/separate-server/src/example/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
(defn on-js-reload []
;; optionally touch your app-state to force rerendering depending on
;; your application
;; (swap! app-state update-in [:__figwheel_counter] inc)
;; (swap! app-state update-in [:__figwheel_counter] (fnil inc 0))
)
2 changes: 1 addition & 1 deletion examples/using-ring-handler/src/example/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
(defn on-js-reload []
;; optionally touch your app-state to force rerendering depending on
;; your application
;; (swap! app-state update-in [:__figwheel_counter] inc)
;; (swap! app-state update-in [:__figwheel_counter] (fnil inc 0))
)

0 comments on commit a61a444

Please sign in to comment.