使用来自 ClojureScript 的 ReactBootstrap 组件

Using ReactBootstrap components from ClojureScript

我有这种依赖:

[cljsjs/react-bootstrap "0.27.3-0"]

,在 cljs 代码中,我试图像这样引用 React Bootstrap 组件:

(defn button [info]
  (js/ReactBootstrap.Nav (js->clj {:key (:id info)}) (:name info))) 

我遇到的问题不是代码,而是组件 (ReactBootstrap.Nav) 未被识别的事实。我在浏览器控制台中收到此错误消息:

Uncaught ReferenceError: ReactBootstrap is not defined

除了 lein 依赖项之外,我还需要执行哪些步骤才能让 ClojureScript 识别 React Bootstrap 组件?

编辑 这是一个愚蠢的错误(以上错误信息是由于缺少或不正确的要求)。我收到了很多错误消息。例如:

Uncaught Error: Invariant Violation: om_alarming$components$nav$MenuBar.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.

我正在尝试使用 Om Next 中的这些 Bootstrap 组件。我还没有找到 Om Next 示例应用程序的任何示例,这些示例应用程序大量使用第三方组件库,以便能够看到它们是如何组合在一起的...

(Om Next 在撰写本文时处于 alpha 阶段)

你还必须 require it. From the README :

(ns application.core ;; replace with your namespace of course
  (:require cljsjs.react-bootstrap))

注意 :我也检查过,只是为了确定这个函数存在于包中,this is the case.