Get rid of pesky React warning in demo

This commit is contained in:
Dan Holmsand 2015-10-07 13:55:16 +02:00
parent 60427a3231
commit 26392052b4
1 changed files with 22 additions and 23 deletions

View File

@ -2,27 +2,26 @@
(:require [reagent.core :as r]
[reagent.debug :refer-macros [dbg println]]))
(defn demo-component []
(let [showing (r/atom true)]
(fn [{:keys [comp src complete no-heading]}]
[:div
(when comp
[:div.demo-example.clearfix
[:a.demo-example-hide {:on-click (fn [e]
(.preventDefault e)
(swap! showing not)
false)}
(if @showing "hide" "show")]
(defn demo-component [{:keys [comp src complete no-heading]}]
(r/with-let [showing (r/atom true)]
[:div
(when comp
[:div.demo-example.clearfix
[:a.demo-example-hide {:on-click (fn [e]
(.preventDefault e)
(swap! showing not)
nil)}
(if @showing "hide" "show")]
(when-not no-heading
[:h3.demo-heading "Example "])
(when @showing
(if-not complete
[:div.simple-demo [comp]]
[comp]))])
(if @showing
(if src
[:div.demo-source.clearfix
(when-not no-heading
[:h3.demo-heading "Example "])
(when @showing
(if-not complete
[:div.simple-demo [comp]]
[comp]))])
(if @showing
(if src
[:div.demo-source.clearfix
(when-not no-heading
[:h3.demo-heading "Source"])
src]
[:div.clearfix]))])))
[:h3.demo-heading "Source"])
src]
[:div.clearfix]))]))