Fork me on GitHub

Oh that author looks familiar! Thanks @borkdude!

Petrus Theron14:07:38

I'd like to make a reusable focused function that calls .focus on a component's root element. So I made this:

(defn focused [comp]                                     
  (with-meta comp
    {:component-did-mount #(.focus (dom-node %))}))
which I think should be usable as [(focused text-input) model], where text-input is an [:input {:type "text" :value @model :on-change #(reset! model (e->value %)}. However, I'm having trouble passing in the model argument to the wrapped component. Any ideas how to do this?


hmmm, is it possible to have focused return a function?


if you want to pass an arg, I believe the output of focused should be a function


I often see error messages from util.cljs, coming from inside render-component. Is there a way to see more specifically where those errors come from?

Petrus Theron19:07:29

Added [re-com "0.5.4"] dependency and getting this error: clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: No single method: _setup of interface: cljs.repl.IJavaScriptEnv found for function: -setup of protocol: IJavaScriptEnv, compiling:(cemerick/piggieback.clj:149:5). I have [org.clojure/clojurescript "0.0-3308" :scope "provided"] set and boot is using Clojure 1.7 to build.


@petrus: I saw someone having an issue with re-com and boot because the clj-time used by re-com was out of date, or something. Only a vague memory.