clojurescripthoplon

Passing a Cell to a defelem Hoplon


Say I had the following custom textarea, how can I pass the etextarea a Cell and have both the :change and the :value work?

(defelem etextarea
  [temp-cell]
  (textarea :value temp-cell 
     :change #(reset! temp-cell @%)))

The code can be modified to include '@temp-cell' or whatever but I have tried many things and whether I pass it '(cell= cell-to-pass)' or 'cell-to-pass' it doesn't seem to work.


Solution

  • (defelem etextarea
             [_ [temp-cell]]
             (textarea :value temp-cell
                       :change (fn [evt]
                                   (reset! temp-cell @evt))))