我正在导入一个反应组分 (使用:npm-deps支持),并使用适配反应类适配器包装:
(:require [reagent.core :as reagent]
[react-helmet])
(def meta-tags* (reagent/adapt-react-class (aget react-helmet "default")))
(defn main-panel []
(let []
(fn []
[meta-tags*])))这对于开发很好,但是当高级编译器打开时:
Uncaught :不能将类作为函数调用
发布于 2017-11-13 20:32:20
meta-tags*是一个类,但是通过将它放置在Reagent正方形大括号(即meta-tags* )中,试图像函数一样调用它。
在您在GitHub上发布的源代码中,还定义了一个名为meta-tags的函数。看起来你不小心给meta-tags*打错电话了。您的完整代码(基于Github演示)应该读如下:
(ns app.views
(:require [reagent.core :as reagent]
[react-helmet]))
(def meta-tags* (reagent/adapt-react-class (aget react-helmet "default")))
(defn meta-tags [{:keys [:title :description]
:or {title "Some title"
description "some description"}}]
[meta-tags* {:id "app-meta-tags"}
[:title {:id "title" :title title}]
[:meta {:id "description" :content description}]])
(defn main-panel []
(let []
(fn []
[:div.container
[meta-tags] ; <- no * star!
[:h1 "Check for the meta-tags presence"]])))https://stackoverflow.com/questions/47272447
复制相似问题