Closed egli closed 2 years ago
Yes, this is a difference between React and normal HTML. It's actually a more convenient model once you are used to it. (React docs)
In reagent that becomes something like this.
(defn my-select []
(let [selected (reagent/atom "apples")]
(fn []
[:select {:value @selected :on-change #(reset! selected (.. % -target -value))}
[:option {:value "apples"} "Apples"]
[:option {:value "pears"} "Pears"]
[:option {:value "oranges"} "Oranges"]])))
For an uncontrolled component use :default-value
instead of :value
(React docs).
The console shows a warning, apparently the selects aren't coded properly