如何在Clojurescipt/Reagent中使用ReactJS组件

duc*_*cky 8 clojurescript reactjs reagent

是否可以将ReactJS组件包装在Clojurescript中与Reagent一起使用?我已经读过它了.有人可以给我一个基本的例子吗?

谢谢

duc*_*cky 7

这是我的解决方案(我将使用React-Bootstrap面板组件):

1)包含react-bootstrap.min.js在你的HTML中.

2)以下是Panel组件的示例用法:

(def PanelComp (. js/ReactBootstrap -Panel))
(defn page
  []
  [:div
   [:div [PanelComp {:header "Panel heading without title"} "Panel content"]]])
Run Code Online (Sandbox Code Playgroud)

  • Reagent 0.5.0使用`adapt-react-class`添加了一种新方法.我有一个样本用[这里](https://gist.github.com/ducky427/10551a3346695db6a5f0) (4认同)