Calling (.setState this #js {:value "123"}) does not change the state of the 
input; it changes the state of your component. Rather than assigning a constant 
expression as input value, you need to lookup the value of state. I recommend 
taking a look at this documentation: 
http://facebook.github.io/react/docs/interactivity-and-dynamic-uis.html

I am not too familiar with quiescent, but I think your desired behavior would 
look something like,

(q/defcomponent [value] 
  (d/input {:type "text" 
            :value (or (.. q/*component* -state -value) "blabla")
            :onChange (fn [event] 
                        (this-as this 
                                 (.setState this #js {:value "123"})))}))


On Sunday, June 1, 2014 1:53:09 AM UTC-7, Răzvan Rotaru wrote:
> Hi,
> 
> 
> 
> I'm playing around with quiescent got stuck in react's controlled components. 
> This may not be quiescent specific, but rather related to clojurescripts js 
> interop. Take following code:
> 
> 
> 
> 
> 
> (q/defcomponent [value]
> 
>   (d/input {:type "text" 
> 
>             :value "blabla"
> 
>             :onChange (fn [event]
> 
>                         (this-as this
> 
>                                  (.setState this #js {:value "123"})
> 
>                                  ))}))
> 
> 
> 
> 
> 
> What I expect is a text input which has the value "blabla", that changes to 
> "123" at the first change event. What I get is a read only input field, with 
> the value "blabla". What am I doing wrong?
> 
> 
> 
> Răzvan

-- 
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 http://groups.google.com/group/clojurescript.

Reply via email to