-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to work around React errors (calling direct / unique key) #48
Comments
Quick follow up, this approach got me a bit closer. I use (vec (concat ...)) to package up the options. (defn Option [props owner]
(om/component
(let [[value display] props]
(dom/option #js {:value value} display))))
(defn Select [props owner]
(om/component
(let [{:keys [label value on-change help placeholder disabled
options default-option default-value]} props
default-value (or default-value "")
default-option (or default-option "Please select")]
(html [:div.form-group
(if label [:label label])
(vec (concat
[:select.form-control {:value (or value default-value)
:placeholder placeholder
:disabled disabled
:on-change on-change}
(if options
(dom/option #js {:value default-value :disabled true} default-option))]
(om/build-all Option options)))
(if help [:p.help-block help])])))) Note: I still have to use (dom/option...) to avoid two of the errors:
|
Oliver George [email protected] writes:
Those are caused by implementation details of Sablono/Om. They will Your 'fixed' error messages is caused by the 'list' of members in the While this is a bit unintuitive given the naming of options to [:label {:key "label"}] etc. I'm not sure if this is intended in Om: I suspect it would be |
Thanks, I'll give that a go. Might be worth having a wiki page noting common causes/resolutions On 22 January 2015 at 20:19, Moritz Ulrich [email protected] wrote:
|
I'm building a select field, using Sablono I get React errors. I'm struggling to see how to avoid them short of completely switching to using pure om controls.
This is my problem code:
I get three react warnings:
And this is what I ended up with to avoid the problem, note use of (apply dom/select...).
My feeling is that I'm missing some standard sablono tricks for handling the case of many children in a vector.
The text was updated successfully, but these errors were encountered: