cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
2020-03-11T11:39:30.017700Z

Hi all! I'm trying to render a TextInput with an initial value. If I set the :value prop it becomes uneditable. googling tells me I should also do onChangeText={text => this.setState({ text })} but I don't see how to translate that to cljs. I'm in a re-frame function that returns hiccup. Do any of you have an example of how to use this-as for a react component?

2020-03-11T11:47:34.018100Z

in this case, it's the value I'd like to change, the placeholder disappears when the user edits. I'm showing an invalid input and asking the user to update that value

2020-03-11T12:49:38.018600Z

Here a simple eg. with input local state

(defn main-panel []
  (let [name (reagent.core/atom "Re-frame")]
    (fn []
      [:div
       [:h1 "Hello from " @name]
       [:input {:value @name
                :on-change #(reset! name (.. % -target -value))}]])))

2020-03-11T13:10:42.018800Z

right, the penny dropped, that is what I wanted, thanks

👍 2