Follow next steps:

lein new figwheel hello-antd -- --reagent

Update project.clj
add antd to :dependencies and update reagent version

[reagent "0.6.2"]
[cljsjs/antd "2.10.0-0"]


In file hello-antd.core use following code
add cljsjs.antd to require

(ns hello-antd.core
  (:require [reagent.core :as reagent :refer [atom]]
            [cljsjs.antd]))


Adapt a button class

(def antbutton (reagent/adapt-react-class antd.Button))


and use in reagent component

(defn hello-world []
  [:div
   [:h1 (:text @app-state)]
   [antbutton
    "Hello"]])


Result is a small ant button.

Instead of adapt-react-class you can use :>

(defn hello-world []
  [:div
   [:h1 (:text @app-state)]
   [:> antd.Button
    "Hello, ant"]])


Let me know if you need full files.

Best regards,
Eduard


On Thursday, May 25, 2017 at 7:00:43 AM UTC+3, zhangen...@gmail.com wrote:
>
> I create a reagent template project, then I want to use a react UI 
> library, like antd (https://ant.design/docs/react/introduce), I think 
> cljsjs/antd can be used, but doesn't success.
>
> I change the function current-page like that:
>
> (defn current-page []
>   [js/antd.Button.])
>
> but doesn't work.
>
> other side, the code like that:
>
> (defn current-page []
>   [:div (js/antd.message.success. "success")])
>
> work success!
>
> I know that is a function call, not a compontent.
> So, how to use compontent like "Button"?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Reagent-Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reagent-project+unsubscr...@googlegroups.com.
To post to this group, send email to reagent-project@googlegroups.com.
Visit this group at https://groups.google.com/group/reagent-project.
For more options, visit https://groups.google.com/d/optout.

Reply via email to