Your code, when compiled will evaluate that (if ...) expression and on-change 
will most likely get nil instead of a function value.

The value you supply to on-change needs to be a function.

Two common ways of doing this are using inline anonymous functions:

(fn [event] (if (= (.-target.value event) "Hello") (reset! greeting "Hello, how 
are you")))

Or using reader shorthand:

#(if (= (.-target.value %) "Hello")  (reset! greeting "Hello, how are you")))

The reagent examples use both styles.

Alternatively, you could define a top level function with defn and just place 
that named function in place of the inline fn.

(defn mygreeting [event] ...)

... elsewhere 

:on-change mygreeting 

Also you might want to use a different name for that component function name - 
the name "input" could be confusing and/or may shadow referred refs/functions.

There may be other things wrong but I'm typing this on my phone w/o a repl.

Good luck!

Alan

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to