Fork me on GitHub
Noah Bogart15:11:46

I have a form 3 component, a function that returns a function that returns hiccup. The outer function needs argument A, while the inner function needs arguments B and C:

(defn example [a b c]
  (let [result (other-call a)]
    (fn [a b c]
      [:div result [other-component b c]])))
Do I need to define a and b and c in both functions? is there a way to avoid it?


Yes. No. If you don't want to see linter warnings about unused symbols, just add _ in front of their name, like _b. Or just replace the names with _ altogether. Alternatively, you can put them all in a single map and destructure only what's needed, like {:keys [a]} in the outer fn and {:keys [b c]} in the inner one.

👍 1
Noah Bogart16:11:58

cool, that’s what I’ve been doing so far! thanks

👍 1