Created
December 27, 2014 17:02
-
-
Save alexslade/18cba1d1f6068679b5da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn update-input [val input] | |
(reset! val (-> input .-target .-value))) | |
(defn new-contact [] | |
(let [val (r/atom "")] | |
(fn [] | |
[:div | |
[:input {:type "text" | |
:placeholder "Contact Name" | |
:value @val | |
:on-change (partial update-input val)}] | |
[:button {:on-click #(when-let [c (parse-contact @val)] | |
(add-contact! c) | |
(reset! val ""))} | |
"Add"]]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment