我正在使用clojurescript 0.0-2371,我試圖編寫一些代碼來克隆一個對象。我有這樣的代碼,我想克隆一個節點,並調用clone-object
功能:clojurescript遍歷對象的鍵
(def animate
(js/React.createClass
#js
{:getInitialState
(fn []
(this-as this
{:children
(->
(.. this -props -children)
(js/React.Children.map (fn [child] child))
(js->clj :keywordize-keys false))}))
:render
(fn []
(this-as this
(let [children (:children (.. this -state))]
(doseq [[k v] children]
(clone-object (aget children k))))))}))
clone-object
看起來是這樣的:
(defn clone-object [obj]
(log/debug obj)
(doseq [[k v] obj]
(log/debug k)))
而且如果我叫clone-object
這樣的:
(doseq [[k v] children]
(clone-object v))
我收到此錯誤:
Uncaught Error: [object Object] is not ISeqable
爲什麼'key'參數? – Marcs 2016-09-22 15:37:48