The re-frame todomvc views namespace contains a function todo-item which contains the following snippet:
(when @editing
[todo-edit {:class "edit"
:title title
:on-save #(dispatch [:save id %])
:on-stop #(reset! editing false)}])
the :on-save key is passed to and used in the todo-input function which contains the following snippet:
let [val (atom title)
stop #(do (reset! val "")
(if on-stop (on-stop)))
save #(let [v (-> @val str clojure.string/trim)]
(if-not (empty? v) (on-save v))
(stop))]
What is the meaning of the % character in the first snippet:
:on-save #(dispatch [:save id %])
and how should I interpret in the second snippet:
(on-save v)
?
Find the todomvc views namespace here.