Last active
August 29, 2015 14:12
-
-
Save alexslade/d74b8cafa1fda0452fe5 to your computer and use it in GitHub Desktop.
This file contains 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 new-contact [] | |
(let [val (r/atom "")] | |
(fn [] | |
[:div | |
[:input {:type "text" | |
:value @val | |
:on-change #(reset! val (-> % .-target .-value))}]]))) | |
; Works fine |
This file contains 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 [input] | |
(reset! val (-> input .-target .-value))) | |
(defn new-contact [] | |
(let [val (r/atom "")] | |
(fn [] | |
[:div | |
[:input {:type "text" | |
:value @val | |
:on-change update-input}]]))) | |
; Gives error: | |
; Uncaught Error: No protocol method IReset.-reset! defined for type function: function val(map_entry){ | |
; return cljs.core._val.call(null,map_entry); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment