Fork me on GitHub
#beginners
<
2016-08-28
>
olegakbarov09:08:37

Hey guys, how do i set the title field in this atom as value of input?

(def state (r/atom {:items {}
                    :input {:title ""
                            :link ""}}))

(defn title-input [name id class placeholder]
  (let []
    [:input.input_field {:type "text" :value (:title (@state :input))
                          ...
                         :on-change #(reset! state update-in [:input :title] (-> % .-target .-value))
}]))
:value (:title (@state :input)) gives me an error i can’t understand:
core.cljs:3485 Uncaught TypeError: Cannot read property 'cljs$lang$maxFixedArity' of undefined
==== EDIT seems like i should use reagent’s cursors here

abarylko09:08:37

Hi folks I’m trying to use resource in compojure-api but not sure how to pass optional query parameters… any help?

akiva13:08:55

@abarylko, do you mean stuff like (GET "/url/path/:id" [id] (process id))?

abarylko17:08:28

@akiva actually (context “/url/path/:id” (resource {:get {:handler (process id)}}))

akiva17:08:04

Ah, I misread that as defroute.