我想使用我在另一个文件/名称空间中创建的试剂组件,例如this.is.the.namespace,它包含这样定义的组件:
(defn component-name []
; stuff
)
在我的输入文件中,执行以下操作:
(ns entry.point.namespace.name
(:require [this.is.the.namespace]
))
并且当我在入口文件的组件中包含[component-name]时,该组件不显示。为什么会这样?
(ns this.is.the.namespace)
(defn component-name []
[:p "Hello There"])
(ns entry.point.namespace.name
(:require [reagent.core :as reagent]
[this.is.the.namespace :as my-components]))
(reagent/render [my-components/component-name] (js/getElementById "main-div"))
将“ main-div”更改为您要渲染到的div的ID。