This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-22
Channels
- # aws (5)
- # bangalore-clj (3)
- # beginners (84)
- # boot (31)
- # carry (1)
- # cider (6)
- # cljsrn (7)
- # clojure (188)
- # clojure-conj (1)
- # clojure-dev (3)
- # clojure-dusseldorf (8)
- # clojure-greece (10)
- # clojure-italy (7)
- # clojure-nl (3)
- # clojure-russia (45)
- # clojure-spec (5)
- # clojure-uk (64)
- # clojurescript (83)
- # clr (9)
- # core-async (45)
- # cursive (55)
- # datomic (8)
- # devops (1)
- # emacs (7)
- # graphql (1)
- # hoplon (3)
- # jobs (1)
- # jobs-discuss (37)
- # lein-figwheel (3)
- # leiningen (4)
- # luminus (6)
- # off-topic (5)
- # om (2)
- # onyx (33)
- # pedestal (13)
- # re-frame (9)
- # reagent (28)
- # rum (15)
- # specter (4)
- # unrepl (38)
- # vim (3)
Hi, in reagent, why should I use :auto-focus
rather than :autofocus
as one of the attributes of an input
field, and should I use :placeholder
or :place-holder
? How can I know this? Are there any docs about this? Thanks!
I think it's :autofocus
, what makes you think otherwise? https://developer.mozilla.org/en/docs/Web/HTML/Element/input
ah wait....
the docs are here: https://facebook.github.io/react/docs/dom-elements.html
looks like react "normalizes" the attributes to camelCase
reagent automatically turns kebab-case
into camelCase
if attributes are already camelCase, it'll leave them alone
anytime 🙂
It doesn't look like the exception is triggered by the code you've show
(defn input-response []
(let [get-result @(subscribe [:get-result])
get-error @(subscribe [:get-error])
post-result @(subscribe [:post-result])
post-error @(subscribe [:post-error])]
[:p
(str
(when get-result
(str "GET result:" get-result))
(when get-error
(str "GET error:" (:last-error get-error) (:last-error-code get-error)))
(when post-result
(str "POST result: " post-result))
(when post-error
(str "POST error:" (:last-error post-error) (:last-error-code post-error))))]))
(defn about-page []
(fn []
(let [!aref (atom nil)
modal-state (r/atom {})]
[:div#wrapper.container.toggled
[:h3 "Input Field"]
[input-field]
[:h5 "Input Response"]
[input-response]
])))
(def pages
{:home #'home-page
:about #'about-page})
(defn page []
[:div
[navbar]
[(pages @(subscribe [:page]))]])
I've commented all the unrelated page and run the page again and tried, still get the same exception message.
(defn input-field []
(let [
;; val (r/atom "Default Text")
;; execute #(do #_(dispatch [:input-execute (-> <@U1BH0DC10> str s/trim)])
;; #_(reset! val ""))
cancel #(do (dispatch [:input-canceled])
#_(reset! val ""))
]
(fn []
[:input {:type "text"
;; :value <@U1BH0DC10>
:value "ttt"
;; :auto-focus true
;; :placeholder "Please input something ..."
;; :on-change #(dispatch [:input-canceled]) #_(reset! val (-> % .-target .-value))
:on-key-down #(dispatch [:input-canceled]) #_(reset! val (-> % .-target .-value))
;; :on-key-down #(case (.-which %)
;; 13 (execute)
;; 27 (cancel)
;; nil)
}])))
I comment out all the unrelated things, still get the same error.cmal: You can, but you shouldn't 🙂 That is what fx are for! https://github.com/Day8/re-frame/blob/master/docs/EffectfulHandlers.md
I think that is where the code get error. If I do not use dispatch in reg-event-db, I will get the error again! But the doc of re-frame
says it is ok if not dispatch-sync.
Could someone give me a hint, how I could use the Tab component from reagent-material?