2014-11-06 68 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组件对这些类型的操作间方案有效。