2014-11-06 27 views
4

我正在嘗試在我的Clojurescript Reagent項目中使用react-router。問題是,反應路由器需要部件傳遞React.isValidClass(component),其在陣營0.11.2定義爲:Reagent生成一個React組件,它傳遞React.isValidClass(組件)?

ReactDescriptor.isValidFactory = function(factory) { 
    return typeof factory === 'function' && 
     factory.prototype instanceof ReactDescriptor; 
}; 

試劑似乎產生部件作爲對象,而不是一個函數。這裏是我的代碼:

(defn home [] 
    [:div [:h1 "Home Page placeholder"]]) 

(reagent/as-component (home)) ; => #<[object Object]> 

有沒有人已經制定了如何使這種互操作的工作?

+0

我發現嘗試在github上做同樣的事情:https://github.com/ghedamat/reagent-react-router,可能會有所幫助。 – zarkone 2015-07-29 05:32:24

回答

1

什麼reagent-react-router確實使這項工作是使用reagent.core/reactify-component。存在reactify-component以使Reagent組件對這些類型的操作間方案有效。

相關問題