Clojurescript reagent/as-element 传递道具?
Clojurescript reagent/as-element pass props?
我正在使用 material-ui 为 clojurescript (reagent-material-ui) 包装的框架和用于小型桌面应用程序的试剂。我想知道,当我使用 reagent/as-element
构造 React 元素的函数 我可以在其中传递 props 和样式吗?如果可以,如何传递?
看起来 ragent-material-ui
正在使用 cljsjs/material-ui "0.19.0-0"
。适用的 material-ui 样式文档是 here.
我会根据文档试一试。
;; Using inline styles
(ns my.project
(:require [reagent-material-ui.core :as ui]
[reagent.core :as reagent]))
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:style {}} ;; Your inline styles here
[ui/MenuItem "Delete"]])
;; Using component specific overrides
;; (depending on the type of element you are styling this will differ)
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:listStyle {}} ;; Your root element overrides here
[ui/MenuItem "Delete"]])
我正在使用 material-ui 为 clojurescript (reagent-material-ui) 包装的框架和用于小型桌面应用程序的试剂。我想知道,当我使用 reagent/as-element
构造 React 元素的函数 我可以在其中传递 props 和样式吗?如果可以,如何传递?
看起来 ragent-material-ui
正在使用 cljsjs/material-ui "0.19.0-0"
。适用的 material-ui 样式文档是 here.
我会根据文档试一试。
;; Using inline styles
(ns my.project
(:require [reagent-material-ui.core :as ui]
[reagent.core :as reagent]))
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:style {}} ;; Your inline styles here
[ui/MenuItem "Delete"]])
;; Using component specific overrides
;; (depending on the type of element you are styling this will differ)
(reagent/as-element [ui/IconMenu
{:iconButtonElement
(el [ui/IconButton {:touch true} [icon "more_vert"]])
:listStyle {}} ;; Your root element overrides here
[ui/MenuItem "Delete"]])