Here is the code I want to convert into ClojureScript:
<Table
onRow={(record, rowIndex) => {
return {
onClick: (event) => {},
onDoubleClick: (event) => {},
};
}}
....
I need to be able to provide multiple events on Table (onRow) component but could not find a way to convert this code into ClojureScript.
onRow
seems expect a "factory" function which returns the actual event handlers.
(defn on-row-factory [record row-index]
#js {:onClick (fn [event] ...)
:onDoubleClick (fn [event] ...)})
;; reagent
[:> Table {:onRow on-row-factory} ...]
You don't need to use the defn
and could just inline a fn
instead.